llvm-for-llvmta/tools/clang/test/CXX/dcl.dcl/dcl.attr/dcl.align/p7.cpp

21 lines
746 B
C++
Raw Normal View History

2022-04-25 13:02:35 +02:00
// 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}}
void pr16992 () {
int x = alignof int; // expected-error {{expected parentheses around type name in alignof expression}}
}