From d39353085e4079ca1eadd787039f7746335225e8 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Thu, 23 Nov 2023 14:47:45 +0100 Subject: [PATCH] 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 Reviewed-by: Fabian Kosmale --- src/tools/moc/moc.cpp | 4 +++- tests/auto/tools/moc/tst_moc.cpp | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) 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*);