tst_QPointer: add checks for CTAD
No pathological findings :) 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> (cherry picked from commit e4f5d86f88a5345257964bf4db56520d852ead83) (cherry picked from commit f476a68ee9678f4f2db6585868937d42d7fbfbd6)
This commit is contained in:
parent
4fd124b432
commit
7a16c0805a
@ -44,6 +44,7 @@ public:
|
||||
|
||||
private slots:
|
||||
void constructors();
|
||||
void ctad();
|
||||
void destructor();
|
||||
void assignment_operators();
|
||||
void equality_operators();
|
||||
@ -69,6 +70,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::destructor()
|
||||
{
|
||||
// Make two QPointer's to the same object
|
||||
|
Loading…
x
Reference in New Issue
Block a user