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

Can't autocomplete a method of template class when the method is defined in a namespace outside class declaration

    XMLWordPrintable

Details

    • Windows
    • bfb63acb09880f9cb2853b5e284a3202de8eab52 (qt-creator/qt-creator/4.14)

    Description

      I'm trying to define a method of some template class outside the class declaration. For example:

      // declare class template
      template <typename T>
      class Foo
      {
          void bar(); 
      }; 
      
      // define class method
      template <typename T> 
      void Foo<T>::bar() // bar is successfully autocompleted
      {}
      

      When I type Foo<T>::b and press Ctrl+Space in the example above the code completion works fine.

      But if I enclose the code above into some namespace then the code completion is broken. For example, when I type Foo<T>::b and press Ctrl+Space in the code below there is no completion suggested:

      namespace foo_bar {
      
      template <typename T>
      class Foo
      {
          void bar(); 
      }; 
      
      // 
      template <typename T> 
      void Foo<T>::bar() // bar IS NOT autocompleted
      {}
      
      }
      

      Though, if I either use the full class name with namespace prefix or define the method after using namespace then the autocompletion works again, see below:

      namespace foo_bar {
      
      template <typename T>
      class Foo
      {
          void bar();
      };
      
      }
      
      // either
      
      template <typename T>
      void foo_bar::Foo<T>::bar() // bar is successfully autocompleted
      {}
      
      // or
      
      using namespace foo_bar;
      
      template <typename T>
      void Foo<T>::bar() // bar is successfully autocompleted
      {}
      
      

      Attachments

        For Gerrit Dashboard: QTCREATORBUG-25244
        # Subject Branch Project Status CR V

        Activity

          People

            kandeler Christian Kandeler
            evgeniums Evgeny Sidorov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes