summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tools/moc/generator.cpp4
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp6
2 files changed, 8 insertions, 2 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 6aaefc452d..694152f436 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -162,7 +162,7 @@ bool Generator::registerableMetaType(const QByteArray &propertyType)
;
foreach (const QByteArray &smartPointer, smartPointers)
- if (propertyType.startsWith(smartPointer + "<"))
+ if (propertyType.startsWith(smartPointer + "<") && !propertyType.endsWith("&"))
return knownQObjectClasses.contains(propertyType.mid(smartPointer.size() + 1, propertyType.size() - smartPointer.size() - 1 - 1));
static const QVector<QByteArray> oneArgTemplates = QVector<QByteArray>()
@@ -171,7 +171,7 @@ bool Generator::registerableMetaType(const QByteArray &propertyType)
#undef STREAM_1ARG_TEMPLATE
;
foreach (const QByteArray &oneArgTemplateType, oneArgTemplates)
- if (propertyType.startsWith(oneArgTemplateType + "<")) {
+ if (propertyType.startsWith(oneArgTemplateType + "<") && !propertyType.endsWith("&")) {
const int argumentSize = propertyType.size() - oneArgTemplateType.size() - 1
// The closing '>'
- 1
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 795a8307f3..7228daa44a 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -2510,6 +2510,12 @@ public slots:
void bu4(CustomObject7, int, CustomObject8) {}
void bu5(int, CustomObject9, CustomObject10) {}
void bu6(int, CustomObject11, int) {}
+
+ // these can't be registered, but they should at least compile
+ void ref1(int&) {}
+ void ref2(QList<int>&) {}
+ void ref3(CustomQObject2&) {}
+ void ref4(QSharedPointer<CustomQObject2>&) {}
};
void tst_Moc::autoPropertyMetaTypeRegistration()