summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsharedpointer
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-08-28 15:57:42 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-08-28 15:57:55 (GMT)
commit31affef31b3743a23cf6f099d6a8f72b371586b4 (patch)
tree2083c23d547ae703df66441e1cb7c03ed9849374 /tests/auto/qsharedpointer
parent7621eec3fb023c7e477080b57c0aba858627091b (diff)
downloadQt-31affef31b3743a23cf6f099d6a8f72b371586b4.zip
Qt-31affef31b3743a23cf6f099d6a8f72b371586b4.tar.gz
Qt-31affef31b3743a23cf6f099d6a8f72b371586b4.tar.bz2
Mark the QSharedPointer with Qt::Uninitialized explicit
That ensures we don't create ambiguities. QSharedPointer shouldn't have any implicit constructors. Suggested-By: Olivier Goffart
Diffstat (limited to 'tests/auto/qsharedpointer')
-rw-r--r--tests/auto/qsharedpointer/tst_qsharedpointer.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
index 93f5b6e..d3df376 100644
--- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
@@ -548,6 +548,13 @@ class OtherObject: public QObject
void tst_QSharedPointer::qobjectWeakManagement()
{
{
+ QWeakPointer<QObject> weak;
+ weak = QWeakPointer<QObject>();
+ QVERIFY(weak.isNull());
+ QVERIFY(!weak.data());
+ }
+
+ {
QObject *obj = new QObject;
QWeakPointer<QObject> weak(obj);
QVERIFY(!weak.isNull());
@@ -1661,6 +1668,11 @@ void tst_QSharedPointer::invalidConstructs_data()
<< "QObject *ptr = new QObject;\n"
"QWeakPointer<QObject> weak = ptr;\n" // this makes the object unmanaged
"QSharedPointer<QObject> shared(ptr);\n";
+
+ QTest::newRow("shared-pointer-implicit-from-uninitialized")
+ << &QTest::QExternalTest::tryCompileFail
+ << "Data *ptr = 0;\n"
+ "QSharedPointer<Data> weakptr = Qt::Uninitialized;\n";
}
void tst_QSharedPointer::invalidConstructs()