blob: 3088a13f78577e5dd7fc484a9a15ea8b0dd1cc3e [file] [log] [blame]
Richard Smith6822bd72018-10-26 19:26:45 +00001// RUN: %clang_cc1 -std=c++11 -triple i386-apple-darwin9 -fsyntax-only -verify -fclang-abi-compat=7 %s
2// expected-no-diagnostics
3
4using size_t = decltype(sizeof(0));
5
6template <typename T, size_t Preferred>
7struct check_alignment {
8 using type = T;
9 static type value;
10
11 static_assert(__alignof__(value) == Preferred, "__alignof__(value) != Preferred");
12 static_assert(__alignof__(type) == Preferred, "__alignof__(type) != Preferred");
13 static_assert(alignof(type) == Preferred, "alignof(type) != Preferred");
14};
15
16// PR3433
17template struct check_alignment<double, 8>;
18template struct check_alignment<long long, 8>;
19template struct check_alignment<unsigned long long, 8>;
20
21// PR6362
22template struct check_alignment<double[3], 8>;
23
24enum big_enum { x = 18446744073709551615ULL };
25template struct check_alignment<big_enum, 8>;