summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/aligned-new1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp1z/aligned-new1.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/aligned-new1.C17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp1z/aligned-new1.C b/gcc/testsuite/g++.dg/cpp1z/aligned-new1.C
new file mode 100644
index 00000000000..735296fd8fa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/aligned-new1.C
@@ -0,0 +1,17 @@
+// { dg-options -std=c++1z }
+// { dg-do run }
+
+#ifndef __STDCPP_DEFAULT_NEW_ALIGNMENT__
+#error __STDCPP_DEFAULT_NEW_ALIGNMENT__ not defined
+#endif
+
+#include <cstdint>
+
+struct alignas(64) A { int i; };
+
+int main()
+{
+ A *p = new A;
+ if (std::intptr_t(p) % 64 != 0)
+ __builtin_abort();
+}