summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/cpp/cpp.predefined/p1.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-09-30 22:41:36 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-09-30 22:41:36 +0000
commit591390284f70b14fbd2f017c50c08785de170c61 (patch)
treee553f8935d8a96e8b8af200d602219ec960839b9 /clang/test/CXX/cpp/cpp.predefined/p1.cpp
parent7d5773e6108d92a8b259e9d4d58ecf1027d06a4f (diff)
downloadbcm5719-llvm-591390284f70b14fbd2f017c50c08785de170c61.tar.gz
bcm5719-llvm-591390284f70b14fbd2f017c50c08785de170c61.zip
P0035R4: add predefined __STDCPP_DEFAULT_NEW_ALIGNMENT__ macro. By default, we
assume that ::operator new provides no more alignment than is necessary for any primitive type, except when we're on a GNU OS, where glibc's malloc guarantees to provide 64-bit alignment on 32-bit systems and 128-bit alignment on 64-bit systems. This can be controlled by the command-line -fnew-alignment flag. llvm-svn: 282974
Diffstat (limited to 'clang/test/CXX/cpp/cpp.predefined/p1.cpp')
-rw-r--r--clang/test/CXX/cpp/cpp.predefined/p1.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/CXX/cpp/cpp.predefined/p1.cpp b/clang/test/CXX/cpp/cpp.predefined/p1.cpp
new file mode 100644
index 00000000000..c0dcbd54f38
--- /dev/null
+++ b/clang/test/CXX/cpp/cpp.predefined/p1.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -std=c++1z %s -verify -triple x86_64-linux-gnu -DALIGN=16
+// RUN: %clang_cc1 -std=c++1z %s -verify -fnew-alignment=2 -DALIGN=2
+// RUN: %clang_cc1 -std=c++1z %s -verify -fnew-alignment=256 -DALIGN=256
+
+// expected-no-diagnostics
+
+#if ALIGN != __STDCPP_DEFAULT_NEW_ALIGNMENT__
+#error wrong value for __STDCPP_DEFAULT_NEW_ALIGNMENT__
+#endif
OpenPOWER on IntegriCloud