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

Add Definition doesn't understand r-value references

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • Qt Creator 2.3.0
    • C/C++/Obj-C++ Support
    • None
    • Arch Linux, KDE desktop environmant

      When you declare a move constructor in .h and you use Add Definition option, a definition that is added in the .cpp file contains a l-value reference type in the constructor's parameter list, instead of the r-value reference type.

      Example:
      If we this declaration in the simple.h file:

      class Simple
      {
      public:
      	Simple();
      	Simple(Simple &&simple);
      	void SetName(QString &&newName);
      	Simple& operator =(Simple &&simple);
      
      private:
      	QString *m_name;
      };
      

      and we use Add Definition option on the Simple(Simple &&simple) in the simple.cpp we will get this:

      Simple::Simple(Simple &simple)
      {
      }
      

      instead we need to get:

      Simple::Simple(Simple &&simple)
      {
      }
      

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

            erikv Erik Verbruggen
            pivonroll Radovan Zivkovic
            Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes