Disable thread-safe statics for MSVC 2015: they're broken

An object that throws in its constructor cannot be reentered. This
violates both C++11 and C++98. It's also a regression from MSVC 2013.

The unit test is renamed to indicate what it really does, as opposed to
a misleading name that was probably a "thinko" on my part.

Task-number: QTBUG-47224
Change-Id: Ib306f8f647014b399b87ffff13f132436d0578ef
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
This commit is contained in:
Thiago Macieira 2015-07-15 11:30:21 -07:00
parent 11ed836403
commit 3aa5ef2ea9
2 changed files with 4 additions and 3 deletions

View File

@ -890,7 +890,8 @@
# define Q_COMPILER_RANGE_FOR
# define Q_COMPILER_REF_QUALIFIERS
# define Q_COMPILER_THREAD_LOCAL
# define Q_COMPILER_THREADSAFE_STATICS
// Broken, see QTBUG-47224 and https://connect.microsoft.com/VisualStudio/feedback/details/1549785
//# define Q_COMPILER_THREADSAFE_STATICS
# define Q_COMPILER_UDL
# define Q_COMPILER_UNICODE_STRINGS
// Uniform initialization is not working yet -- build errors with QUuid

View File

@ -50,7 +50,7 @@ private Q_SLOTS:
void api();
void constVolatile();
void exception();
void threadedException();
void catchExceptionAndRetry();
void threadStressTest();
void afterDestruction();
};
@ -142,7 +142,7 @@ void tst_QGlobalStatic::exception()
QBasicAtomicInt exceptionControlVar = Q_BASIC_ATOMIC_INITIALIZER(1);
Q_GLOBAL_STATIC_WITH_ARGS(ThrowingType, exceptionGS, (exceptionControlVar))
void tst_QGlobalStatic::threadedException()
void tst_QGlobalStatic::catchExceptionAndRetry()
{
if (exceptionControlVar.load() != 1)
QSKIP("This test cannot be run more than once");