Skip to content

Commit

Permalink
QMetaType of non-const ref: play nice with template instantiations
Browse files Browse the repository at this point in the history
...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.

Task-number: QTBUG-106672
Change-Id: Ica9b13fee95eda97cafab2cccdc5249dfc3dcdf2
Reviewed-by: Ulf Hermann <[email protected]>
(cherry picked from commit 9b3de58)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
  • Loading branch information
Inkane authored and Qt Cherry-pick Bot committed Sep 22, 2022
1 parent b404ad5 commit 617e1fe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/corelib/kernel/qmetatype.h
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,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>
Expand Down

0 comments on commit 617e1fe

Please sign in to comment.