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

moving function definition outside does not work as expected

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • P2: Important
    • Resolution: Fixed
    • Qt Creator 6.0.1, Qt Creator 6.0.2, Qt Creator 7.0.0
    • Qt Creator 7.0.1
    • C/C++/Obj-C++ Support
    • None
    • Windows

    Description

      struct Base {
          virtual auto func() && noexcept -> void = 0;
      };
      struct Derived : public Base {
          auto func() && noexcept -> void override {}
      };
      

      I tried "Refactor > Move Definition Outside Class" menu for Derived::func() and here's the result:

      struct Base {
          virtual auto func() && noexcept -> void = 0;
      };
      struct Derived : public Base {
          auto func() && noexcept -> void;
      };
      
      void Derived::func() &&noexcept override {}
      

      You can see two problems here:

      1. override keyword should not appear in function definition outside class. This is syntax error. Same problem occurs with final keyword. 
      2. trailing return type function declaration is converted to pre-C++11 style. This is espacially annoying because I have to rewrite every defintion one by one.

      One more thing, you may noticed that the space after reference specifier && is removed in function definition outside class. Eventhough this is a formatting issue and can be fixed by re-formatting, it would be nice to keep original format.

      Attachments

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

        Activity

          People

            kandeler Christian Kandeler
            xylosper Byoung-young Lee
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes