Details
-
Type:
Bug
-
Status: Closed
-
Priority:
P3: Somewhat important
-
Resolution: Done
-
Affects Version/s: Qt Creator 4.12.0, Qt Creator 4.12.1, Qt Creator 4.12.2
-
Fix Version/s: Qt Creator 4.13.0-beta1
-
Component/s: Analyzer: Clang Tidy & Clazy, C/C++/Obj-C++ Support
-
Labels:None
-
Environment:Windows 10
Qt 5.14, msvc2017_64
Visual Studio 15.9
Qt Creator 4.12.3
-
Platform/s:
-
Commits:53b4d6975d5458395c10b55e99d12886ea224c49 (qt-creator/qt-creator/4.13)
Description
When Q_PROPERTY is used with types like QMap<Foo, Bar>, or other template type with comma, Clang Code Model and Clazy Analyzer cannot handle the comma, and produces error:
// error: too many arguments provided to function-like macro invocation // qobjectdefs.h:62:9: note: macro 'Q_PROPERTY' defined here Q_PROPERTY(QMap<int, QString> keyNames MEMBER keyNames)
The code compiles and works well on official Windows/macOS Qt kits.
The error may come from qobjectdefs.h delivered with QtCreator. This header patches <QtCore/qobjectdefs.h> to for Clang Code Model and Clazy. However, the overriding Q_PROPERTY macro definition does not support variadic macro:
// share/qtcreator/cplusplus/wrappedQtHeaders/QtCore/qobjectdefs.h #define Q_PROPERTY(arg) static_assert("Q_PROPERTY", #arg);
Without the overriding macro definition, the code compiles and Clang/Clazy stops complaining about it.