diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-09-26 10:27:17 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-09-26 21:14:39 +0200 |
commit | 5222df2be7d10bf44dfc2971774eadcb526b7a13 (patch) | |
tree | edfb8017f762f8da18536fb0c7e8897b23ce6ca0 /src/tools | |
parent | 9527581239b8179034c4f95dc858581a7ee9efb6 (diff) |
moc: Add basic support for nested inline namespaces
This improves moc's support for nested inline namespaces, so that code
containing them will not break compilation.
For simplicity, we allow nested inline namespaces even in C++17 mode
(the actual C++ compiler will reject the code anyway, and probably with
a better error message than moc could output).
moc still has no real awareness how inline namespaces work, but that is
a preexisting issue.
Pick-to: 6.4 6.2
Fixes: QTBUG-106920
Change-Id: I7b415a99133575f101bc81d01d4670a5f752917f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/moc/moc.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 979c986a41..58e28687aa 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -606,6 +606,12 @@ void Moc::parse() QByteArray nsName = lexem(); QByteArrayList nested; while (test(SCOPE)) { + /* treat (C++20's) namespace A::inline B {} as A::B + this is mostly to not break compilation when encountering such + a construct in a header; the interaction of Qt's meta-macros with + inline namespaces is still rather poor. + */ + test(INLINE); next(IDENTIFIER); nested.append(nsName); nsName = lexem(); |