// RUN: %clang_cc1 -std=c++2a -x c++ %s -verify
static_assert;
static_assert;
static_assert; // expected-error{{member reference base type 'int' is not a structure or union}}
void
static_assert;
// Substitution failure in expression
;
;
;
requires // expected-note{{because 'a + b' would be invalid: invalid operands to binary expression ('A' and 'const A')}} expected-note{{because 'a + b' would be invalid: invalid operands to binary expression ('C' and 'const C')}}
;
using r1i1 = r1<int>;
using r1i2 = r1<A>; // expected-error{{constraints not satisfied for class template 'r1' [with T = A]}}
using r1i3 = r1<B>;
using r1i4 = r1<C>; // expected-error{{constraints not satisfied for class template 'r1' [with T = C]}}
;
requires // expected-note{{because 'a.foo()' would be invalid: no member named 'foo' in 'A'}} expected-note{{because 'a.foo()' would be invalid: member reference base type 'int' is not a structure or union}} expected-note{{because 'a.foo()' would be invalid: 'this' argument to member function 'foo' has type 'const D', but function is not marked const}}
;
using r2i1 = r2<int>; // expected-error{{constraints not satisfied for class template 'r2' [with T = int]}}
using r2i2 = r2<A>; // expected-error{{constraints not satisfied for class template 'r2' [with T = A]}}
using r2i3 = r2<D>;
using r2i4 = r2<const D>; // expected-error{{constraints not satisfied for class template 'r2' [with T = const D]}}
requires requires // expected-note{{because 'sizeof(T)' would be invalid: invalid application of 'sizeof' to an incomplete type 'void'}} expected-note{{because 'sizeof(T)' would be invalid: invalid application of 'sizeof' to an incomplete type 'nonexistent'}}
;
using r3i1 = r3<int>;
using r3i2 = r3<A>;
using r3i3 = r3<A &>;
using r3i4 = r3<void>; // expected-error{{constraints not satisfied for class template 'r3' [with T = void]}}
using r3i4 = r3<class nonexistent>; // expected-error{{constraints not satisfied for class template 'r3' [with T = nonexistent]}}
// Non-dependent expressions
requires
;
using r4i1 = r4<int>;
using r4i2 = r4<int>;
using r4i3 = r4<int>;
// Noexcept requirement
void
static_assert;
static_assert;
;
;
requires // expected-note{{because 't ++' may throw an exception}}
;
using r5i1 = r5<int>;
using r5i2 = r5<E>;
using r5i2 = r5<F>; // expected-error{{constraints not satisfied for class template 'r5' [with T = F]}}
requires // expected-note{{because 't.foo()' would be invalid: no member named 'foo' in 'E'}}
;
using r6i = r6<E>; // expected-error{{constraints not satisfied for class template 'r6' [with T = E]}}
constexpr bool is_same_v = false;
constexpr bool is_same_v<T, T> = true;
;
;
concept Same = is_same_v<T, U>;
concept Large = sizeof >= 4;
// expected-note@-1{{because 'sizeof(typename remove_reference<short &>::type) >= 4' (2 >= 4) evaluated to false}}
requires // expected-note{{because 'short &' does not satisfy 'Large':}}
;
using r7i1 = r7<int>;
using r7i2 = r7<short>; // expected-error{{constraints not satisfied for class template 'r7' [with T = short]}}
requires
;
using r8i1 = r8<int>;
using r8i2 = r8<short*>;
// Substitution failure in type constraint
requires
// expected-note@-1{{because 'Same<expr-type, typename T::type &>' would be invalid: type 'int' cannot be used prior to '::' because it has no members}}
;
;
using r9i1 = r9<M>;
using r9i2 = r9<int>; // expected-error{{constraints not satisfied for class template 'r9' [with T = int]}}
// Substitution failure in both expression and return type requirement
requires // expected-note{{because 't.foo()' would be invalid: member reference base type 'int' is not a structure or union}}
;
using r10i = r10<int>; // expected-error{{constraints not satisfied for class template 'r10' [with T = int]}}
// Non-type concept in type constraint
concept IsEven = == 0;
requires // expected-error{{concept named in type constraint is not a type concept}}
;
// Value categories
requires void
;
// C++ [expr.prim.req.compound] Example