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

Issues with overriding virtual functions in a different namespace

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P3: Somewhat important
    • None
    • Qt Creator 2.7.0-rc, Qt Creator 2.8.0-beta, Qt Creator 4.7.0-beta1
    • C/C++/Obj-C++ Support

    Description

      First we define these classes:

      namespace BaseNamespace {
      struct BaseClass1 { };
      
      struct BaseClass2 { virtual void func(const BaseClass1 &) {} };
      }
      

      Now we derive from BaseClass2 in a different namespace:

      namespace DerivedNamespace {
      struct DerivedClass : public BaseNamespace::BaseClass2 {
          void func(const BaseClass1 &);
      };
      }
      

      Issue 1: When auto-completing the parameter type of func in DerivedClass, the base class namespace is not added, so the auto-completed declaration is not syntactically correct.

      Now let's assume the definition of DerivedClass is in a header file, and we have a corresponding cpp file into which we put the definition of the overridden func:

      void DerivedNamespace::DerivedClass::func(const BaseClass1 &) { }
      

      Issue 2: If we try to add the correct namespace to the parameter type in the header file, the light bulb indicating the availability of refactoring operations will appear only until we type the first colon of the "::" separator and then go away, so Qt Creator will not offer to add the namespace also in the cpp file, forcing the user to do this by hand as well.

      Attachments

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

        Activity

          People

            kandeler Christian Kandeler
            kandeler Christian Kandeler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes