summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools/moc/tst_moc.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-06-09 13:59:07 +0200
committerPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-06-09 13:59:07 +0200
commit0963be63ce741ef6c7585358c3f3b1cb806b66e8 (patch)
tree6f4964c196b8a52cb15e9efc0388b6a549574460 /tests/auto/tools/moc/tst_moc.cpp
parent9e6a1351823b3ee3d7e380248f6ef42ff383b014 (diff)
parenteacfbbf64ef90dad8c5cb6b2c812ad64c1100779 (diff)
Merge remote-tracking branch 'qt/dev' into dev-highdpi
Conflicts: src/gui/kernel/qsimpledrag.cpp src/gui/kernel/qwindowsysteminterface.cpp src/gui/kernel/qwindowsysteminterface_p.h src/plugins/platforms/xcb/qxcbwindow.cpp Change-Id: Icd887552ade61d6a2b2527383970f7145aa00faf
Diffstat (limited to 'tests/auto/tools/moc/tst_moc.cpp')
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 00e5c60b29..350c6142d2 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -87,6 +87,18 @@ struct QTBUG_31218_Derived : QTBUG_31218<-1<0> {};
class QTBUG_45790 : Bug() { };
#endif
+class CreatableGadget
+{
+ Q_GADGET
+public:
+ Q_INVOKABLE CreatableGadget()
+ {
+ CreatableGadget::qt_static_metacall((QObject*)this, QMetaObject::ReadProperty, -1, Q_NULLPTR);
+ }
+};
+
+CreatableGadget creatableGadget; // Force the compiler to use the constructor
+
struct MyStruct {};
struct MyStruct2 {};
@@ -680,7 +692,7 @@ void tst_Moc::oldStyleCasts()
QStringList args;
args << "-c" << "-x" << "c++" << "-Wold-style-cast" << "-I" << "."
- << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIE" << "-";
+ << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-";
proc.start("gcc", args);
QVERIFY(proc.waitForStarted());
proc.write(mocOut);
@@ -750,7 +762,7 @@ void tst_Moc::inputFileNameWithDotsButNoExtension()
QStringList args;
args << "-c" << "-x" << "c++" << "-I" << ".."
- << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIE" << "-";
+ << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-";
proc.start("gcc", args);
QVERIFY(proc.waitForStarted());
proc.write(mocOut);
@@ -1029,7 +1041,7 @@ void tst_Moc::ignoreOptionClashes()
// If -pthread wasn't ignored, it was parsed as a prefix of "thread/", which breaks compilation.
QStringList gccArgs;
gccArgs << "-c" << "-x" << "c++" << "-I" << ".."
- << "-I" << qtIncludePath << "-I" << includeDir << "-o" << "/dev/null" << "-fPIE" << "-";
+ << "-I" << qtIncludePath << "-I" << includeDir << "-o" << "/dev/null" << "-fPIC" << "-";
proc.start("gcc", gccArgs);
QVERIFY(proc.waitForStarted());
proc.write(mocOut);
@@ -1870,6 +1882,13 @@ void tst_Moc::warnings_data()
<< 1
<< QString()
<< QString("standard input:5: Error: Class declaration lacks Q_OBJECT macro.");
+
+ QTest::newRow("QTBUG-46210: crash on invalid macro")
+ << QByteArray("#define Foo(a, b, c) a b c #a #b #c a##b##c #d\n Foo(45);")
+ << QStringList()
+ << 1
+ << QString("IGNORE_ALL_STDOUT")
+ << QString(":2: Error: '#' is not followed by a macro parameter");
}
void tst_Moc::warnings()