Details
-
Bug
-
Resolution: Done
-
P2: Important
-
6.3.1
-
None
-
-
5222df2be7 (qt/qtbase/dev) 5222df2be7 (qt/tqtc-qtbase/dev) 430047ecc8 (qt/tqtc-qtbase/6.2) c2750da343 (qt/qtbase/6.4) c2750da343 (qt/tqtc-qtbase/6.4)
Description
Attempting to build the following:
#include <QObject> namespace A::inline B {} class Foo : public QObject { Q_OBJECT };
will fail at the auto MOC step with the message:
foo.h:3:1 error: Parse error at "::"
Using:
#ifndef Q_MOC_RUN namespace A::inline B {} #endif
around the offending namespace line allows the auto MOC step to complete.
It would appear the MOC is not able to handle c++20 nested inline namespace. (See syntax (9) here: https://en.cppreference.com/w/cpp/language/namespace)
Use case of interest
The problem was discovered while trying out the mp-units library (https://github.com/mpusz/units) which as of its 0.7.0 release does use the nested inline namespace feature. (For instance, here: https://github.com/mpusz/units/blob/v0.7.0/src/systems/isq-natural/include/units/isq/natural/acceleration.h)
While this can be deactivated with a macro in this case (i.e. UNITS_NO_ALIASES), nested inline namespace are still something that should probably be supported by the MOC.
Attachments
Issue Links
- relates to
-
QTBUG-117765 moc chokes on <concepts> from xcode13
- Closed
For Gerrit Dashboard: QTBUG-106920 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
434882,3 | moc: Add basic support for nested inline namespaces | dev | qt/qtbase | Status: MERGED | +2 | 0 |
435184,2 | moc: Add basic support for nested inline namespaces | 6.4 | qt/qtbase | Status: MERGED | +2 | 0 |
435185,4 | moc: Add basic support for nested inline namespaces | tqtc/lts-6.2 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |