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

Partial type-template specialization is not recognized correctly

    XMLWordPrintable

Details

    • 2070431d8ca867acfb4391c275cd82caff4d711a, 997ab425ce5cb0797101acadcfe9217ea1aa6813

    Description

      Example:

      test.cpp
      struct b {};
      
      template<class X, class Y>
      struct s
      {
      	float f;
      };
      
      template<class X> // l.9
      struct s<X, b>
      {
      	int i;
      };
      
      void f()
      {
      	s<int, b> var;
      	(void)var.i;
      }
      

      This compiles on clang++, but Qt Creator suggests that var has only a member "f".

      Note: Specializing the first parameter instead of the second does not work either:

      first.cpp
      template<class Y> struct s<int, Y> { /*...*/ };
      

      Note: If you make line 9/10 a full specialization, Qt Creator recognizes everything correctly., i.e. this works:

      full.cpp
      template<> struct s<int, b> { /*...*/ };
      

      Again, I'm not sure whether this is a bug or a wanted feature for saving runtime.

      Attachments

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

        Activity

          People

            orgads Orgad Shaneh
            qtfan Johannes Lorenz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes