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

Template parameters appear as namespaces, when defining a template method inside a template class contained in a namespace

XMLWordPrintable

    • All

      When defining a template method inside a template class, and such class is defined in a namespace, the template parameters belonging to the class are reported in the same level as namespaces in the outline panel, and the highlighting is wrong.

      Please use the following test code:

      hallo.hpp:

      namespace MyNameSpace
      {
        template< typename A, typename B >
        class MyClass
        {
          A _a;
          B _b;
        public:
          explicit MyClass(A a, B b);
      
          void myMethod();
      
        private:
          template< typename C >
          void myF(C c);
        };
      }
      

      hallo.cpp:

      #include "hallo.hpp"
      
      namespace MyNameSpace
      {
        template< typename A, typename B >
        MyClass< A, B >::MyClass(A a, B b) :
          _a(a),
          _b(b)
        {
        }
      
        template< typename A, typename B >
        template< typename C >
        void MyClass< A, B >::myF(C)
        {
        }
      
        template< typename A, typename B >
        void MyClass< A, B >::myMethod()
        {
        }
      }
      

      Regarding myF, the outline then contains wrong items, and the highlighting of A/B is wrong (compared to C). Also the symbol lookup combobox contains invalid items (please see the enclosed screenshot).

        1. Bug_template_namespace.png
          57 kB
          Antonio Di Monaco
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            kandeler Christian Kandeler
            becrux Antonio Di Monaco
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes