summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2023-11-23 14:47:45 +0100
committerMichal Klocek <michal.klocek@qt.io>2023-11-24 08:48:01 +0100
commitd39353085e4079ca1eadd787039f7746335225e8 (patch)
treee9240900ee4e18edfc04b3f5df35ba7221684c0a
parent905593a40b6e161189ab3da663d037f0b47e04b0 (diff)
Moc: don't stumple over inline namespace in more places
Ignore the 'inline' in case of nested namespace with another nested inline namespace. Amends 5222df2be7d10bf44dfc2971774eadcb526b7a13 Fixes: QTBUG-117765 Pick-to: 6.6 6.5 Change-Id: I87f2649606f63c818f225f8cc5ec914920763c5f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r--src/tools/moc/moc.cpp4
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp3
2 files changed, 6 insertions, 1 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index cc5cc929b9..c1fa36c87a 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -706,8 +706,10 @@ void Moc::parse()
switch (next()) {
case NAMESPACE:
if (test(IDENTIFIER)) {
- while (test(SCOPE))
+ while (test(SCOPE)) {
+ test(INLINE); // ignore inline namespaces
next(IDENTIFIER);
+ }
if (test(EQ)) {
// namespace Foo = Bar::Baz;
until(SEMIC);
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index b4d5525da3..a7fe0e9455 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -77,6 +77,9 @@ const char *string_hash_hash = STRING_HASH_HASH("baz");
of writing this comment.
*/
namespace A::inline B {}
+namespace A {
+ namespace B::inline C {}
+}
#endif
Q_DECLARE_METATYPE(const QMetaObject*);