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

“Insert Virtual Functions" doesn't work with using-declaration type inside a different namespace

    XMLWordPrintable

Details

    • Windows
    • 319a5ccd8 (master)

    Description

      Qt Creator offers the "Insert Virtual Functions of Base Classes" option when a base type has virtual functions.

      However, Qt Creator seemingly fails to parse base types behind a using-declaration in a different namespace. Here's the minimal reproducible code snippet:

       

      namespace A {
      struct Base
      {
          virtual void foo() = 0;
      };
      } // namespace A
      
      using A::Base;
      // typedef A::Base Base;
      
      struct Derived : Base
      {};

      Focus the text cursor on the Base after struct Derived :, then Press "Alt + Enter" to open the Refactor menu. The "Insert Virtual Functions" isn't available.

      A workaround is to use typedef instead. In the above code snippet, comment out using-declaration and uncomment typedef, then open the Refactor menu, and "Insert Virtual Functions" will be available for use.

      However, typedef doesn't work with class templates, using-declaration is required to alias a class template.

      Attachments

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

        Activity

          People

            kandeler Christian Kandeler
            jclink Jessia Clinkscale
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes