QMetaType of non-const ref: play nice with template instantiations

...by making QMetaTypeId2 contain all expected members.
While we don't allow QMetaType from non-const references, we want to
get to the static_assert telling us as much, instead of running into
more or less incomprehensible error messages in the depths of
qmetatype.h.

Pick-to: 6.4
Task-number: QTBUG-106672
Change-Id: Ica9b13fee95eda97cafab2cccdc5249dfc3dcdf2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Fabian Kosmale 2022-09-18 16:27:32 +02:00
parent d8387fc538
commit 9b3de58d2d

View File

@ -1204,7 +1204,12 @@ template <typename T>
struct QMetaTypeId2<const T&> : QMetaTypeId2<T> {};
template <typename T>
struct QMetaTypeId2<T&> { enum {Defined = false }; };
struct QMetaTypeId2<T&>
{
using NameAsArrayType = void;
enum { Defined = false, IsBuiltIn = false };
static inline constexpr int qt_metatype_id() { return 0; }
};
namespace QtPrivate {
template <typename T, bool Defined = QMetaTypeId2<T>::Defined>