1// RUN: %clang_cc1 -std=c++11 -verify %s 2 3// expected-no-diagnostics 4using size_t = decltype(sizeof(0)); 5 6template<typename T, typename U> 7constexpr T max(T t, U u) { return t > u ? t : u; } 8 9template<typename T, typename ...Ts> 10constexpr auto max(T t, Ts ...ts) -> decltype(max(t, max(ts...))) { 11 return max(t, max(ts...)); 12} 13 14template<typename...T> struct my_union { 15 alignas(T...) char buffer[max(sizeof(T)...)]; 16}; 17 18struct alignas(8) A { char c; }; 19struct alignas(4) B { short s; }; 20struct C { char a[16]; }; 21 22static_assert(sizeof(my_union<A, B, C>) == 16, ""); 23static_assert(alignof(my_union<A, B, C>) == 8, ""); 24