tst_qdbusmetatype: fix build with Clang (and probably MSVC)

This test makes use of a GCC extension-slash-defect in matching of
template template parameters. Either Clang has recently changed its
behavior not to accept them any more, or we've never compiled this test
with Clang.

Tested with Clang 15.0.6.

Pick-to: 6.4
Change-Id: I69ecc04064514f939896fffd172e98d826989ca3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Thiago Macieira 2022-12-07 11:16:05 -08:00 committed by Marc Mutz
parent f222053c0b
commit abaa3e6112

View File

@ -245,7 +245,14 @@ void tst_QDBusMetaType::initTestCase()
qDBusRegisterMetaType<QList<Struct3> >();
qDBusRegisterMetaType<QList<Struct4> >();
#ifdef Q_CC_GNU_ONLY
// GCC has a defect/extension (depending on your point of view) that allows
// a template class with defaulted template parameters to match a Template
// Template Parameter (TTP) with fewer template arguments. The call below
// tries to use the template<template <typename> class Container, ...>
// template functions qdbusargument.h
qDBusRegisterMetaType<std::vector<Struct1> >();
#endif
qDBusRegisterMetaType<Invalid0>();
qDBusRegisterMetaType<Invalid1>();
@ -307,7 +314,9 @@ void tst_QDBusMetaType::dynamicTypes_data()
QTest::newRow("Struct1") << qMetaTypeId<Struct1>() << "(s)";
QTest::newRow("QList<Struct1>") << qMetaTypeId<QList<Struct1> >() << "a(s)";
#ifdef Q_CC_GNU_ONLY
QTest::newRow("std::vector<Struct1>") << qMetaTypeId<std::vector<Struct1> >() << "a(s)";
#endif
QTest::newRow("Struct2") << qMetaTypeId<Struct2>() << "(sos)";
QTest::newRow("QList<Struct2>") << qMetaTypeId<QList<Struct2>>() << "a(sos)";