summaryrefslogtreecommitdiffstats
path: root/test/CXX/dcl.dcl/dcl.attr/dcl.align/p7.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/dcl.dcl/dcl.attr/dcl.align/p7.cpp')
-rw-r--r--test/CXX/dcl.dcl/dcl.attr/dcl.align/p7.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.align/p7.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.align/p7.cpp
new file mode 100644
index 0000000..93b1c64
--- /dev/null
+++ b/test/CXX/dcl.dcl/dcl.attr/dcl.align/p7.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -std=c++11 -verify %s
+
+template<typename T, typename A, int N> struct X {
+ alignas(T) alignas(A) T buffer[N];
+};
+
+static_assert(alignof(X<char, int, sizeof(int)>) == alignof(int), "");
+static_assert(alignof(X<int, char, 1>) == alignof(int), "");
+
+
+template<typename T, typename A, int N> struct Y {
+ alignas(A) T buffer[N]; // expected-error {{requested alignment is less than minimum alignment of 4 for type 'int [1]'}}
+};
+
+static_assert(alignof(Y<char, int, sizeof(int)>) == alignof(int), "");
+static_assert(alignof(Y<int, char, 1>) == alignof(int), ""); // expected-note {{in instantiation of}}
OpenPOWER on IntegriCloud