diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 8a5abd30201..5e2ba18a005 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -40,6 +40,9 @@ bool Moc::parseClassHead(ClassDef *def) return false; } while (token); + // support attributes like "class [[deprecated]]] name" + skipCxxAttributes(); + if (!test(IDENTIFIER)) // typedef struct { ... } return false; QByteArray name = lexem(); diff --git a/tests/auto/tools/moc/cxx-attributes.h b/tests/auto/tools/moc/cxx-attributes.h index 799a13293cc..6301d7804ca 100644 --- a/tests/auto/tools/moc/cxx-attributes.h +++ b/tests/auto/tools/moc/cxx-attributes.h @@ -10,7 +10,7 @@ QT_WARNING_PUSH QT_WARNING_DISABLE_CLANG("-Wunknown-attributes") QT_WARNING_DISABLE_GCC("-Wattributes") -class CppAttribute : public QObject +class [[deprecated]] CppAttribute : public QObject { Q_OBJECT signals: