QMetaType: fix void* parameters
Commit 3695b35dfc accounted for pointer to
other incomplete types, but pointer-to-void was missed. This caused an
inconsistency in the stored metatype for void*, which is a built-in type
(QMetaType::VoidStar) but no pointer was recorded.
The test in tst_moc hadn't been enabled because the functions in
questions weren't extracted by moc. That is fixed in this commit.
Change-Id: I6f936da6f6e84d649f70fffd1706f613517a75fb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
bb10
parent
3410b1dc9c
commit
59065a8530
|
|
@ -2547,9 +2547,9 @@ constexpr const QMetaTypeInterface *qTryMetaTypeInterfaceForType()
|
|||
using Ty = typename MetatypeDecay<T>::type;
|
||||
using Tz = qRemovePointerLike_t<Ty>;
|
||||
|
||||
if constexpr (std::is_void_v<Ty>) {
|
||||
if constexpr (std::is_void_v<Tz>) {
|
||||
// early out to avoid expanding the rest of the templates
|
||||
return &QMetaTypeInterfaceWrapper<void>::metaType;
|
||||
return &QMetaTypeInterfaceWrapper<Ty>::metaType;
|
||||
} else if constexpr (ForceComplete::value) {
|
||||
checkTypeIsSuitableForMetaType<Ty>();
|
||||
return &QMetaTypeInterfaceWrapper<Ty>::metaType;
|
||||
|
|
|
|||
|
|
@ -1671,6 +1671,78 @@
|
|||
"className": "TestPointeeCanBeIncomplete",
|
||||
"object": true,
|
||||
"qualifiedClassName": "TestPointeeCanBeIncomplete",
|
||||
"slots": [
|
||||
{
|
||||
"access": "public",
|
||||
"arguments": [
|
||||
{
|
||||
"type": "QPointer<FwdClass>"
|
||||
}
|
||||
],
|
||||
"name": "setProp1",
|
||||
"returnType": "void"
|
||||
},
|
||||
{
|
||||
"access": "public",
|
||||
"arguments": [
|
||||
{
|
||||
"type": "QSharedPointer<FwdClass>"
|
||||
}
|
||||
],
|
||||
"name": "setProp2",
|
||||
"returnType": "void"
|
||||
},
|
||||
{
|
||||
"access": "public",
|
||||
"arguments": [
|
||||
{
|
||||
"type": "QWeakPointer<FwdClass>"
|
||||
}
|
||||
],
|
||||
"name": "setProp3",
|
||||
"returnType": "void"
|
||||
},
|
||||
{
|
||||
"access": "public",
|
||||
"arguments": [
|
||||
{
|
||||
"type": "FwdClass*"
|
||||
}
|
||||
],
|
||||
"name": "setProp4",
|
||||
"returnType": "void"
|
||||
},
|
||||
{
|
||||
"access": "public",
|
||||
"arguments": [
|
||||
{
|
||||
"type": "const FwdClass*"
|
||||
}
|
||||
],
|
||||
"name": "setProp5",
|
||||
"returnType": "void"
|
||||
},
|
||||
{
|
||||
"access": "public",
|
||||
"arguments": [
|
||||
{
|
||||
"type": "void*"
|
||||
}
|
||||
],
|
||||
"name": "setProp6",
|
||||
"returnType": "void"
|
||||
},
|
||||
{
|
||||
"access": "public",
|
||||
"arguments": [
|
||||
{
|
||||
"type": "const void*"
|
||||
}
|
||||
],
|
||||
"name": "setProp7",
|
||||
"returnType": "void"
|
||||
}
|
||||
],
|
||||
"superClasses": [
|
||||
{
|
||||
"access": "public",
|
||||
|
|
|
|||
|
|
@ -14,10 +14,14 @@ class FwdClass;
|
|||
class TestPointeeCanBeIncomplete : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
public slots:
|
||||
void setProp1(QPointer<FwdClass>) {}
|
||||
void setProp2(QSharedPointer<FwdClass>) {}
|
||||
void setProp3(const QWeakPointer<FwdClass> &) {}
|
||||
void setProp4(FwdClass *) {}
|
||||
void setProp5(const FwdClass *) {}
|
||||
void setProp6(void *) {}
|
||||
void setProp7(const void *) {}
|
||||
};
|
||||
|
||||
#endif // POINTERY_TO_INCOMPLETE_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue