From 8c1cb66712a339b09988d8ef2b15ce39678178a6 Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Sun, 2 Sep 2012 16:30:47 +0200 Subject: Fix moc generating invalid code for slots with reference types as argument. We can't have T& declared/registered as a metatype (wont compile), but using it as type for a slot argument is possible. With the recent introduction of metatype auto-registration we have to make sure that moc doesn't attempt to auto-register those. Simple types are handled correctly already, this fixes containers and smart pointers. Change-Id: Id96857c57d6ebf158a67e9d527c89dc195473b1b Reviewed-by: Stephen Kelly --- src/tools/moc/generator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/tools/moc') 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 oneArgTemplates = QVector() @@ -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 -- cgit v1.2.3