diff options
Diffstat (limited to 'sources/shiboken2/generator/shiboken2')
-rw-r--r-- | sources/shiboken2/generator/shiboken2/shibokengenerator.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp index ac0b2ffaf..a226f2c00 100644 --- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp @@ -1055,12 +1055,26 @@ bool ShibokenGenerator::isValueTypeWithCopyConstructorOnly(const AbstractMetaCla { if (!metaClass || !metaClass->typeEntry()->isValue()) return false; - if ((metaClass->attributes() & AbstractMetaAttributes::HasRejectedConstructor) != 0) + if (metaClass->attributes().testFlag(AbstractMetaAttributes::HasRejectedDefaultConstructor)) return false; - AbstractMetaFunctionList ctors = metaClass->queryFunctions(AbstractMetaClass::Constructors); - if (ctors.count() != 1) - return false; - return ctors.constFirst()->functionType() == AbstractMetaFunction::CopyConstructorFunction; + const AbstractMetaFunctionList ctors = + metaClass->queryFunctions(AbstractMetaClass::Constructors); + bool copyConstructorFound = false; + for (auto ctor : ctors) { + switch (ctor->functionType()) { + case AbstractMetaFunction::ConstructorFunction: + return false; + case AbstractMetaFunction::CopyConstructorFunction: + copyConstructorFound = true; + break; + case AbstractMetaFunction::MoveConstructorFunction: + break; + default: + Q_ASSERT(false); + break; + } + } + return copyConstructorFound; } bool ShibokenGenerator::isValueTypeWithCopyConstructorOnly(const TypeEntry* type) const |