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

      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

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

          Activity

            People

            Assignee:
            kandeler Christian Kandeler
            Reporter:
            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