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

Incorrect auto-generation of the constructor definition of a template class that takes in variadic arguments

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • Qt Creator 15.0.0
    • C/C++/Obj-C++ Support
    • Linux/X11

    Description

      There are two files (one header file and its implementation file) in a C++ static-library project:
      ClassA.h
      ClassA.cpp

      ClassA.h has the following:

      template<typename... Args>
      class ClassA
      {
      public:
        explicit ClassA(Args&&... args);
        ~ClassA();
      private:
        std::tuple<Args...> values;
      };

      Inside the Qt Creator's text editor, bring the mouse-cursor over the name of the constructor and press the right-click to open the context menu. Select "Refactor" -> "Add Definition in ClassA.cpp".

      It auto-generates incorrect constructor definition:

      template<typename Args>
      ClassA<Args>::ClassA(Args &&args)
      {
      }

      The correct constructor definition is:

      template<typename... Args>
      ClassA<Args...>::ClassA(Args&&... args)
      {
      }
      

       

      Same is with auto-generation of any member functions of ClassA (if you add some). It omits the three dots.

      Attachments

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

        Activity

          People

            kandeler Christian Kandeler
            someguyhi Sumit Singh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes