Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.8.0, 5.12.4, 5.13.0
-
None
-
* Manjaro Linux 4.10.4
* Qt 5.8.0
Description
The following code fails to compile:
class TestObject : public QObject { Q_OBJECT // this provokes the error Q_PROPERTY(TestFlags flags2 MEMBER flags) public: enum TestFlag { Flag1 = 0x01, Flag2 = 0x02, Flag4 = 0x04 }; Q_DECLARE_FLAGS(TestFlags, TestFlag) Q_FLAG(TestFlags) explicit TestObject(QObject *parent = 0); TestFlags flags; };
It's an error in moc, the error is in the following function:
void TestObject::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) { //... case 0: *reinterpret_cast<int*>(_v) = QFlag(_t->()); break; }
As far as I can see, moc assumes a read accessor, and ignores the MEMBER accessor. It happens for writing the property, too.
The error message gcc gives is:
moc_testobject.cpp: In statischer Elementfunktion »static void TestObject::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)«: moc_testobject.cpp:86:52: Fehler: expected primary-expression before »(« token case 0: *reinterpret_cast<int*>(_v) = QFlag(_t->()); break; ^