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 <thiago.macieira@intel.com>
This commit is contained in:
parent
841f445c7f
commit
b6e9ff22a3
@ -1663,7 +1663,13 @@ void tst_QSharedPointer::invalidConstructs_data()
|
|||||||
|
|
||||||
// use of forward-declared class
|
// use of forward-declared class
|
||||||
QTest::newRow("forward-declaration")
|
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
|
<< &QTest::QExternalTest::tryRun
|
||||||
|
#endif
|
||||||
<< "forwardDeclaredDestructorRunCount = 0;\n"
|
<< "forwardDeclaredDestructorRunCount = 0;\n"
|
||||||
"{ QSharedPointer<ForwardDeclared> ptr = QSharedPointer<ForwardDeclared>(forwardPointer()); }\n"
|
"{ QSharedPointer<ForwardDeclared> ptr = QSharedPointer<ForwardDeclared>(forwardPointer()); }\n"
|
||||||
"exit(forwardDeclaredDestructorRunCount);";
|
"exit(forwardDeclaredDestructorRunCount);";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user