tst_QPointer: add checks for CTAD

No pathological findings :)

Pick-to: 6.6 6.5 6.2
Change-Id: Ifbbca223a5e612e7abb67c0364d4354a9d8174e3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2023-10-02 18:44:00 +02:00
parent 1ba4f73692
commit 1cf0f8e7c3

View File

@ -19,6 +19,7 @@ public:
private slots:
void constructors();
void ctad();
void conversion();
void destructor();
void assignment_operators();
@ -45,6 +46,47 @@ void tst_QPointer::constructors()
QCOMPARE(p3, QPointer<QObject>(this));
}
void tst_QPointer::ctad()
{
{
QObject o;
QPointer po = &o;
static_assert(std::is_same_v<decltype(po), QPointer<QObject>>);
QPointer poc = po;
static_assert(std::is_same_v<decltype(poc), QPointer<QObject>>);
QPointer pom = std::move(po);
static_assert(std::is_same_v<decltype(pom), QPointer<QObject>>);
}
{
const QObject co;
QPointer pco = &co;
static_assert(std::is_same_v<decltype(pco), QPointer<const QObject>>);
QPointer pcoc = pco;
static_assert(std::is_same_v<decltype(pcoc), QPointer<const QObject>>);
QPointer pcom = std::move(pco);
static_assert(std::is_same_v<decltype(pcom), QPointer<const QObject>>);
}
{
QFile f;
QPointer pf = &f;
static_assert(std::is_same_v<decltype(pf), QPointer<QFile>>);
QPointer pfc = pf;
static_assert(std::is_same_v<decltype(pfc), QPointer<QFile>>);
QPointer pfm = std::move(pf);
static_assert(std::is_same_v<decltype(pfm), QPointer<QFile>>);
}
{
const QFile cf;
QPointer pcf = &cf;
static_assert(std::is_same_v<decltype(pcf), QPointer<const QFile>>);
QPointer pcfc = pcf;
static_assert(std::is_same_v<decltype(pcfc), QPointer<const QFile>>);
QPointer pcfm = std::move(pcf);
static_assert(std::is_same_v<decltype(pcfm), QPointer<const QFile>>);
}
}
void tst_QPointer::conversion()
{
// copy-conversion: