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

Refactor -> add definition in X.cpp: template arguments discarded when using nested classes

XMLWordPrintable

    • 9c78ba83c (master)

      Steps to reproduce:

      • Create new project
      • Add class Foo
      • Modify the header:
        Foo.h
        #include <list>
        
        class Bar;
        using namespace std;
        
        class Foo
        {
        public:
          Foo();
          list<Bar> baz();
          void baz2(list<Bar> bar);
          list<Bar>::iterator baz3();
          void baz4(list<Bar>::iterator bar);
        };
        
      • Use "right click -> refactor -> add definition in Foo.cpp" for all 4 added methods
      • The generated code goes as such:
        Foo.cpp
        #include "foo.h"
        
        Foo::Foo(){} // Fine
        list<Bar> Foo::baz(){} // Fine
        void Foo::baz2(list<Bar> bar){} // Fine
        list::iterator Foo::baz3(){} // Missing template argument
        void Foo::baz4(list::iterator bar){} // Missing template argument
        

      The same thing happens when using "add definition outside class"

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

            kandeler Christian Kandeler
            khaur Khaur
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes