tst_QPointer: add checks for CTAD
No pathological findings :) Pick-to: 6.5 6.2 Change-Id: Ifbbca223a5e612e7abb67c0364d4354a9d8174e3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 1cf0f8e7c3feb923ff08247d83d185c6aea986eb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
7844d919ce
commit
e4f5d86f88
@ -19,6 +19,7 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void constructors();
|
void constructors();
|
||||||
|
void ctad();
|
||||||
void conversion();
|
void conversion();
|
||||||
void destructor();
|
void destructor();
|
||||||
void assignment_operators();
|
void assignment_operators();
|
||||||
@ -45,6 +46,47 @@ void tst_QPointer::constructors()
|
|||||||
QCOMPARE(p3, QPointer<QObject>(this));
|
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()
|
void tst_QPointer::conversion()
|
||||||
{
|
{
|
||||||
// copy-conversion:
|
// copy-conversion:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user