Richard Smith | 6822bd7 | 2018-10-26 19:26:45 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++11 -triple i386-apple-darwin9 -fsyntax-only -verify -fclang-abi-compat=7 %s |
| 2 | // expected-no-diagnostics |
| 3 | |
| 4 | using size_t = decltype(sizeof(0)); |
| 5 | |
| 6 | template <typename T, size_t Preferred> |
| 7 | struct 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 |
| 17 | template struct check_alignment<double, 8>; |
| 18 | template struct check_alignment<long long, 8>; |
| 19 | template struct check_alignment<unsigned long long, 8>; |
| 20 | |
| 21 | // PR6362 |
| 22 | template struct check_alignment<double[3], 8>; |
| 23 | |
| 24 | enum big_enum { x = 18446744073709551615ULL }; |
| 25 | template struct check_alignment<big_enum, 8>; |