diff options
Diffstat (limited to 'tests/auto/tools/moc')
-rw-r--r-- | tests/auto/tools/moc/qmlmacro.h | 19 | ||||
-rw-r--r-- | tests/auto/tools/moc/tst_moc.cpp | 11 |
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/tools/moc/qmlmacro.h b/tests/auto/tools/moc/qmlmacro.h new file mode 100644 index 0000000000..cb3b291bf1 --- /dev/null +++ b/tests/auto/tools/moc/qmlmacro.h @@ -0,0 +1,19 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + + +#ifndef QMlMACRO_H +#define QMlMACRO_H + +#include <QObject> +#include <QByteArray> + +struct QmlMacro : QObject +{ + Q_OBJECT + Q_CLASSINFO("QML.Element", "auto") + + signals: + void f(QByteArray &b); +}; +#endif diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index d2946efb3f..8862b0daf2 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -56,12 +56,23 @@ #include "fwdclass2.h" #include "fwdclass3.h" +#include "qmlmacro.h" + #ifdef Q_MOC_RUN // check that moc can parse these constructs, they are being used in Windows winsock2.h header #define STRING_HASH_HASH(x) ("foo" ## x ## "bar") const char *string_hash_hash = STRING_HASH_HASH("baz"); #endif +#if defined(Q_MOC_RUN) || __cplusplus > 202002L +/* Check that nested inline namespaces are at least not causing moc to break. + Check it even outside of C++20 mode as moc gets passed the wrong __cplusplus version + and also to increase coverage, given how few C++20 configurations exist in the CI at the time + of writing this comment. +*/ +namespace A::inline B {} +#endif + Q_DECLARE_METATYPE(const QMetaObject*); #define TESTEXPORTMACRO Q_DECL_EXPORT |