// RUN: %clang_cc1 -std=c++2a -verify %s // Make sure constraint expressions are unevaluated before being substituted // into during satisfaction checking. template constexpr bool f = T::value; // expected-error@-1 4{{type}} namespace unevaluated { template concept Foo = false && f; bool k = Foo; template requires false && f struct S {}; // expected-note@-1{{because}} using s = S; // expected-error {{constraints not satisfied}} template void foo() requires false && f { }; // expected-note@-1{{because}} expected-note@-1{{candidate template ignored}} int a = (foo(), 0); // expected-error{{no matching function}} template void bar() requires requires { requires false && f; } { }; // expected-note@-1{{because}} expected-note@-1{{candidate template ignored}} int b = (bar(), 0); // expected-error{{no matching function}} template struct M { static void foo() requires false && f { }; }; // expected-note@-1{{because}} int c = (M::foo(), 0); // expected-error@-1{{invalid reference to function 'foo': constraints not satisfied}} } namespace constant_evaluated { template requires f struct S {}; // expected-note@-1{{in instantiation of}} expected-note@-1{{while substituting}} \ expected-error@-1{{substitution into constraint expression resulted in a non-constant expression}} \ expected-note@-1{{subexpression not valid}} using s = S; // expected-note@-1 2{{while checking}} template void foo() requires f { }; // expected-note@-1{{in instantiation}} expected-note@-1{{while substituting}} \ expected-note@-1{{candidate template ignored}} expected-note@-1{{subexpression not valid}} \ expected-error@-1{{substitution into constraint expression resulted in a non-constant expression}} int a = (foo(), 0); // expected-note@-1 2{{while checking}} expected-error@-1{{no matching function}} \ expected-note@-1 2{{in instantiation}} template void bar() requires requires { requires f; } { }; // expected-note@-1{{in instantiation}} expected-note@-1{{subexpression not valid}} \ expected-note@-1{{while substituting}} \ expected-error@-1{{substitution into constraint expression resulted in a non-constant expression}} \ expected-note@-1 2{{while checking the satisfaction of nested requirement}} int b = (bar(), 0); template struct M { static void foo() requires f { }; }; // expected-note@-1{{in instantiation}} expected-note@-1{{subexpression not valid}} \ expected-note@-1{{while substituting}} \ expected-error@-1{{substitution into constraint expression resulted in a non-constant expression}} int c = (M::foo(), 0); // expected-note@-1 2{{while checking}} }