From b6e9ff22a376ae94b884a22c85f89f4c37056e5e Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Tue, 6 Dec 2011 13:34:15 +0100 Subject: Fix tst_QSharedPointer invalidConstructs:forward-declaration failure When using clang, the forward-declaration test fails to link, unlike with other compilers. The standard says that deleting a forward-declared pointer is undefined behavior, so the link failure is a valid result of trying to do so. Change-Id: I527b91c15b7d51d9522d95af0630e7dacd26bb30 Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/auto/corelib/tools') diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp index e62ee0f051..7eb1bd2dee 100644 --- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp @@ -1663,7 +1663,13 @@ void tst_QSharedPointer::invalidConstructs_data() // use of forward-declared class QTest::newRow("forward-declaration") +#ifdef Q_CC_CLANG + // Deleting a forward declaration is undefined, which results in a linker error with clang + << &QTest::QExternalTest::tryLinkFail +#else + // Other compilers accept the code, but do not call the destructor at run-time << &QTest::QExternalTest::tryRun +#endif << "forwardDeclaredDestructorRunCount = 0;\n" "{ QSharedPointer ptr = QSharedPointer(forwardPointer()); }\n" "exit(forwardDeclaredDestructorRunCount);"; -- cgit v1.2.3