Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.6.0 Alpha
-
None
-
Linux
Qt 5.6 beta snapshot (18-Nov-2015 07:33)
-
4a4b17805c976b40a404b48ba51984c9abdba633
Description
We get a compiler error with current Qt 5.6 beta snapshot.
Qt 5.5.0 works with same example.
g++ -c -pipe -g -std=gnu+0x -Wall -W -D_REENTRANT -fPIC -DQT_TESTLIB_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR='"/tmp/ee"' -I/home/andre/untitled4 -I. -I/home/andre/hg/libs/5.6/dist/include -I/home/andre/hg/libs/5.6/dist/include/QtTest -I/home/andre/hg/libs/5.6/dist/include/QtCore -I. -I/home/andre/hg/libs/5.6/dist/mkspecs/linux-g+ -o main.o /home/andre/untitled4/main.cpp
In file included from /home/andre/hg/libs/5.6/dist/include/QtTest/qtest.h:38:0,
from /home/andre/hg/libs/5.6/dist/include/QtTest/QtTest:7,
from /home/andre/untitled4/main.cpp:3:
/home/andre/hg/libs/5.6/dist/include/QtTest/qtestcase.h: In instantiation of 'typename QtPrivate::QEnableIf<QtPrivate::IsQEnumHelper<T>::Value, char*>::Type QTest::Internal::toString(T) [with T = Dummy::DummyEnum; typename QtPrivate::QEnableIf<QtPrivate::IsQEnumHelper<T>::Value, char*>::Type = char*]':
/home/andre/hg/libs/5.6/dist/include/QtTest/qtestcase.h:255:34: required from 'char* QTest::toString(const T&) [with T = Dummy::DummyEnum]'
/home/andre/hg/libs/5.6/dist/include/QtTest/qtestcase.h:320:39: required from 'bool QTest::qCompare(const T&, const T&, const char*, const char*, const char*, int) [with T = Dummy::DummyEnum]'
/home/andre/untitled4/main.cpp:23:2: required from here
/home/andre/hg/libs/5.6/dist/include/QtTest/qtestcase.h:241:23: error: no matching function for call to 'QMetaEnum::key(Dummy::DummyEnum&)'
return qstrdup(me.key(e));
^
In file included from /home/andre/hg/libs/5.6/dist/include/QtCore/QtCore:68:0,
from /home/andre/untitled4/main.cpp:2:
/home/andre/hg/libs/5.6/dist/include/QtCore/qmetaobject.h:213:17: note: candidate: const char* QMetaEnum::key(int) const
const char *key(int index) const;
^
/home/andre/hg/libs/5.6/dist/include/QtCore/qmetaobject.h:213:17: note: no known conversion for argument 1 from 'Dummy::DummyEnum' to 'int'
Makefile:936: recipe for target 'main.o' failed
make: *** [main.o] Error 1
#include <QCoreApplication> #include <QtCore/QtCore> #include <QtTest/QtTest> class Dummy { Q_GADGET public: enum class DummyEnum { FIRST, SECOND }; Q_ENUM(DummyEnum) }; void testing() { QCOMPARE(Dummy::DummyEnum::FIRST, Dummy::DummyEnum::FIRST); QCOMPARE(Dummy::DummyEnum::FIRST, Dummy::DummyEnum::SECOND); } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); testing(); return a.exec(); }
QT += core testlib QT -= gui TARGET = untitled4 CONFIG += console CONFIG -= app_bundle CONFIG += c++11 TEMPLATE = app SOURCES += main.cpp