Work around MSVC compilation issue
MSVC does not seem to instantiate code in the else branch of the constexpr if statement even though the condition is true. This causes an error if the PropertyType is void, as we then would attempt to create an object of type void. Work-around the issue by explicitly checking that the type is not void. Fixes: QTBUG-92962 Change-Id: Ie5acb6fae532bcc441be34418d4724de9d65b340 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
parent
6560778616
commit
2136406b4c
@ -199,7 +199,7 @@ struct BindingFunctionVTable
|
||||
static_assert (std::is_invocable_r_v<bool, Callable, QMetaType, QUntypedPropertyData *> );
|
||||
auto untypedEvaluationFunction = static_cast<Callable *>(f);
|
||||
return std::invoke(*untypedEvaluationFunction, metaType, dataPtr);
|
||||
} else {
|
||||
} else if constexpr (!std::is_same_v<PropertyType, void>) { // check for void to woraround MSVC issue
|
||||
Q_UNUSED(metaType);
|
||||
QPropertyData<PropertyType> *propertyPtr = static_cast<QPropertyData<PropertyType> *>(dataPtr);
|
||||
// That is allowed by POSIX even if Callable is a function pointer
|
||||
@ -211,6 +211,10 @@ struct BindingFunctionVTable
|
||||
}
|
||||
propertyPtr->setValueBypassingBindings(std::move(newValue));
|
||||
return true;
|
||||
} else {
|
||||
// Our code will never instantiate this
|
||||
Q_UNREACHABLE();
|
||||
return false;
|
||||
}
|
||||
},
|
||||
/*destroy*/[](void *f){ static_cast<Callable *>(f)->~Callable(); },
|
||||
|
Loading…
Reference in New Issue
Block a user