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