From 19e0fc747ea3acf069c8c26c8fb2f1941bc916f2 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 2 Mar 2018 15:13:45 +0100 Subject: moc: Don't error our when parsing "using namespace __identifier(...)" This follows on from a2322519929bd36a90422dccc0310b8230729197 which covered a similar instance of this. As with that change, we should not abort the compilation, just ignore it. Task-number: QTBUG-63772 Change-Id: Ide958080a90f43ed19edd8a320e7d45de1c96821 Reviewed-by: Olivier Goffart (Woboq GmbH) (cherry picked from commit 0da3ebd9940a214cc7ea292d13cd86967cd89a66) --- src/tools/moc/moc.cpp | 3 +++ tests/auto/tools/moc/namespace.h | 1 + 2 files changed, 4 insertions(+) diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 4d3ccb8680..c44502c953 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -674,6 +674,9 @@ void Moc::parse() if (test(NAMESPACE)) { while (test(SCOPE) || test(IDENTIFIER)) ; + // Ignore invalid code such as: 'using namespace __identifier("x")' (QTBUG-63772) + if (test(LPAREN)) + until(RPAREN); next(SEMIC); } break; diff --git a/tests/auto/tools/moc/namespace.h b/tests/auto/tools/moc/namespace.h index 43d00e82f3..7f1e46cd62 100644 --- a/tests/auto/tools/moc/namespace.h +++ b/tests/auto/tools/moc/namespace.h @@ -76,6 +76,7 @@ namespace FooNamespace { #ifdef Q_MOC_RUN namespace __identifier("") {} // QTBUG-56634 +using namespace __identifier(""); // QTBUG-63772 #endif #endif // NAMESPACE_H -- cgit v1.2.3