Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
6.4
-
6bdeafcad (dev), 83697e49e (6.5)
Description
If a type is marked with QML_ELEMENT, but does not have a default ctor, it becomes uncreatable. Unless the type has been explicitly marked as such, that should create an actionable warning message, or even a compile time error.
We might be able to get a compilation error by having the macro expand to
consteval void check() {
using Self = std::remove_cvref_t<decltype(*this);
static_assert(!std::is_default_constructible<Self>> || is_uncreatable<Self>);
}
However, we would need to evaluate the compile time overhead of such a solution, and potentially deal with shadowing warning.
Attachments
Issue Links
- is duplicated by
-
QTBUG-106093 No specific warning when trying to expose a C++ type to QML which has no default constructor
- Closed
-
QTBUG-87834 Provide a more detailed error message when a C++ type that's exposed to QML cannot be created
- Closed