diff options
Diffstat (limited to 'test/SemaCXX/alignof.cpp')
-rw-r--r-- | test/SemaCXX/alignof.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/SemaCXX/alignof.cpp b/test/SemaCXX/alignof.cpp index 011f459..e3690ea 100644 --- a/test/SemaCXX/alignof.cpp +++ b/test/SemaCXX/alignof.cpp @@ -77,3 +77,23 @@ namespace alignof_array_expr { // ok, does not complete type of S<-1>::a static_assert(alignof(S<-1>::a) == alignof(int), ""); // expected-warning {{GNU extension}} } + +template <typename T> void n(T) { + alignas(T) int T1; + char k[__alignof__(T1)]; + static_assert(sizeof(k) == alignof(long long), ""); +} +template void n(long long); + +namespace PR22042 { +template <typename T> +void Fun(T A) { + typedef int __attribute__((__aligned__(A))) T1; // expected-error {{requested alignment is dependent but declaration is not dependent}} + int k1[__alignof__(T1)]; +} + +template <int N> +struct S { + typedef __attribute__((aligned(N))) int Field[sizeof(N)]; // expected-error {{requested alignment is dependent but declaration is not dependent}} +}; +} |