1 // RUN: %clang_cc1 -std=c++11 -verify %s
2
3 template<typename T, typename A, int N> struct X {
4 alignas(T) alignas(A) T buffer[N];
5 };
6
7 static_assert(alignof(X<char, int, sizeof(int)>) == alignof(int), "");
8 static_assert(alignof(X<int, char, 1>) == alignof(int), "");
9
10
11 template<typename T, typename A, int N> struct Y {
12 alignas(A) T buffer[N]; // expected-error {{requested alignment is less than minimum alignment of 4 for type 'int [1]'}}
13 };
14
15 static_assert(alignof(Y<char, int, sizeof(int)>) == alignof(int), "");
16 static_assert(alignof(Y<int, char, 1>) == alignof(int), ""); // expected-note {{in instantiation of}}
17
pr16992()18 void pr16992 () {
19 int x = alignof int; // expected-error {{expected parentheses around type name in alignof expression}}
20 }
21