Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-71123

"moc" failed to parse auto in trailing-return-type signals and slots

    XMLWordPrintable

Details

    • Windows
    • 12b8283f899ebcf401d974927314b9531334a56e (qt/qtbase/dev) 4fd10b68d4ec813b031415872e2ab296a062fb6f (qt/qtbase/6.1) a85766e97967fa249bc66e36504780ba72bea2a4 (qt/tqtc-qtbase/5.15)

    Description

      If I try to write signals/slots with trailing-return-type as described here(https://en.cppreference.com/w/cpp/language/function), that feature become available with C++11 standard decltype.

      signals:
          auto testSignal() -> void;
      
      public slots:
          auto testSlot() -> void;
      

      But my compilation faild, as I understand moc cannot parse this signature, and gives error like that:

      \AutoReturn\TestClass.hpp -o debug\moc_TestClass.cpp
      ..\AutoReturn\TestClass.hpp(12): Parse error at ":"
      

      You could reproduce this issue on my small example AutoReturn.zip

      Attachments

        1. AutoReturn.zip
          2 kB
        2. moc.zip
          27 kB

        Issue Links

          Activity

            People

              manordheim Mårten Nordheim
              AndriySlisarchuk Andriy Slisarchuk
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: