summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2013-05-18 11:24:12 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-20 10:06:04 +0200
commit208e9a2757ae9146e538fffe399c18ee4259a84a (patch)
tree7c2f09b7517efbc8829f97ab2fae61564cbb8fa5 /tests/auto/tools
parentf1d1b8219cbb94ec327047d71ebdc6510317ce3b (diff)
moc: recover bad template parsing.
When encountering code such as: X<a<b> moc does not have the mean to know if 'a' is a type or a variable, so the type parser currently assume that '<' always open a template parameter. (instead of being the operator<) The type parser do not care about the actual type, it just need to strip the string out. The problem is that then the whole rest of the file will be considered as the type. With this patch, we also stop the parsing at semicolon. The type will be wrong, but this allow the parser to recover and it will continue to look for more classes after this. (In other words, moc will no longer break if it encounter such construct in a header. But it will still not parse such types correctly if used within a Q_OBJECT class) Task-number: QTBUG-31218 Change-Id: I1fef6bc58493d7c00df72401c9ad55463b24eaa7 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/tools')
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index e0179b393b..923275d928 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -79,6 +79,9 @@
QT_USE_NAMESPACE
+template <bool b> struct QTBUG_31218 {};
+struct QTBUG_31218_Derived : QTBUG_31218<-1<0> {};
+
struct MyStruct {};
struct MyStruct2 {};