Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-29113

Headers with template specializations are flagged as unused

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Not Evaluated
    • None
    • Qt Creator 10.0.0
    • C/C++/Obj-C++ Support
    • None
    • Linux/X11

    Description

      QtCreator marks headers as unused if the headers contain class template specializations that are actually used by the code in the file that includes the header.

      // common.h
      template< typename T >
      struct parser
      {
          static void parse(T&) {}
      };
      
      template< typename T >
      void parse(T& val)
      {
          parser<T>::parse(val);
      }
      
      // specialization.h
      #include <vector>
      
      template< typename T >
      struct parser;
      
      template< typename T >
      struct parser< std::vector<T> >
      {
          static void parse(std::vector<T>&) {}
      };
      
      // test.cpp
      #include <vector>
      #include <common.h>
      #include <specialization.h> // <- wrongly flagged as unused
      
      void foo()
      {
          std::vector<int> vec;
          parse(vec);
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kandeler Christian Kandeler
            lastique Andrey Semashev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes