// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template struct A { enum { id = _Generic(T(), // expected-error {{controlling expression type 'char' not compatible with any generic association type}} int: 1, // expected-note {{compatible type 'int' specified here}} float: 2, U: 3) // expected-error {{type 'int' in generic association compatible with previously specified type 'int'}} }; }; static_assert(A::id == 1, "fail"); static_assert(A::id == 2, "fail"); static_assert(A::id == 3, "fail"); A a1; // expected-note {{in instantiation of template class 'A' requested here}} A a2; // expected-note {{in instantiation of template class 'A' requested here}} template struct B { enum { id = _Generic(T(), int: 1, // expected-note {{compatible type 'int' specified here}} int: 2, // expected-error {{type 'int' in generic association compatible with previously specified type 'int'}} U: 3) }; }; template struct Or { enum { result = Arg | Or::result }; }; template struct Or { enum { result = Arg }; }; template struct TypeMask { enum { result = Or<_Generic(Args(), int: 1, long: 2, short: 4, float: 8)...>::result }; }; static_assert(TypeMask::result == 7, "fail"); static_assert(TypeMask::result == 12, "fail"); static_assert(TypeMask::result == 9, "fail");