summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2016-04-25 10:59:31 -0700
committerThiago Macieira <thiago.macieira@intel.com>2016-05-29 18:45:13 +0000
commit0f559a2d998d7ff5b7dec83a1c7e8a9996cbaa26 (patch)
treed4f954146ca4e945f7461fea94d97f39989da34f /tests
parent9e9888f69aa0b78d10b16f85235918f9d41db152 (diff)
Force the use of the C++11 alignof keyword instead of an extension
If the compiler supports C++11 alignof, let's use it. No point in perpetuating the use of __alignof__ or __alignof. There's a fallback implementation in qglobal.h that works even without compiler extensions. We can't drop it just yet (alignas is not a required C++11 feature), but at this point I doubt that fallback is used anywhere anymore. The tst_compiler test was wrong to use alignof(variable). That's not permitted by the standard nor would it work with our fallback implementation. MSVC 2015 enforces this, but ICC, GCC and Clang don't. Change-Id: Ifea6e497f11a461db432ffff1448abfa86672c63 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/other/compiler/tst_compiler.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/auto/other/compiler/tst_compiler.cpp b/tests/auto/other/compiler/tst_compiler.cpp
index 540c155fd8..8cd25bf164 100644
--- a/tests/auto/other/compiler/tst_compiler.cpp
+++ b/tests/auto/other/compiler/tst_compiler.cpp
@@ -636,9 +636,10 @@ void tst_Compiler::cxx11_alignas()
#ifndef Q_COMPILER_ALIGNAS
QSKIP("Compiler does not support C++11 feature");
#else
- alignas(double) char c;
- Q_UNUSED(c);
- QCOMPARE(Q_ALIGNOF(c), Q_ALIGNOF(double));
+ struct S {
+ alignas(double) char c;
+ };
+ QCOMPARE(Q_ALIGNOF(S), Q_ALIGNOF(double));
#endif
}