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

"Add definition in Class.cpp" for friend functions tries to define function as memberfunction

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • Qt Creator 3.5.1
    • C/C++/Obj-C++ Support
    • None

      If you are adding things like friend operators to a class like this:

      MyClass

      { public: friend operator==(const MyClass& lhs, const MyClass& rhs); }

      you can click "Add definition to class.cpp" to create a definition. The definition incorrectly looks like this:

      bool MyClass::operator==(const MyClass& lhs, const MyClass& rhs)
      {

      }

      The MyClass:: part should not be there, as a friend function can be declared inside the scope of the class but is not a member function of that class.

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

            kandeler Christian Kandeler
            andre André Somers
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes