26 lines · cpp
1// RUN: %clang_cc1 -std=c++11 -triple i386-apple-darwin9 -fsyntax-only -verify -fclang-abi-compat=7 %s2// expected-no-diagnostics3 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// PR343317template struct check_alignment<double, 8>;18template struct check_alignment<long long, 8>;19template struct check_alignment<unsigned long long, 8>;20 21// PR636222template struct check_alignment<double[3], 8>;23 24enum big_enum { x = 18446744073709551615ULL };25template struct check_alignment<big_enum, 8>;26