// RUN: %clang_cc1 -std=c++2a -x c++ -verify %s template constexpr bool is_ptr_v = false; template constexpr bool is_ptr_v = true; template constexpr bool is_same_v = false; template constexpr bool is_same_v = true; template requires is_ptr_v // expected-note {{because 'is_ptr_v' evaluated to false}} // expected-note@-1{{because 'is_ptr_v' evaluated to false}} auto dereference(T t) { // expected-note {{candidate template ignored: constraints not satisfied [with T = int]}} // expected-note@-1{{candidate template ignored: constraints not satisfied [with T = char]}} return *t; } static_assert(is_same_v(nullptr)), int>); static_assert(is_same_v); // expected-error {{no matching function for call to 'dereference'}} static_assert(is_same_v('a')), char>); // expected-error {{no matching function for call to 'dereference'}} template requires (T{} + T{}) // expected-note {{because substituted constraint expression is ill-formed: invalid operands to binary expression ('A' and 'A')}} auto foo(T t) { // expected-note {{candidate template ignored: constraints not satisfied [with T = A]}} return t + t; } template requires (!((T{} - T{}) && (T{} + T{})) || false) // expected-note@-1{{because substituted constraint expression is ill-formed: invalid operands to binary expression ('A' and 'A')}} // expected-note@-2{{and 'false' evaluated to false}} auto bar(T t) { // expected-note {{candidate template ignored: constraints not satisfied [with T = A]}} return t + t; } struct A { }; static_assert(foo(A{})); // expected-error {{no matching function for call to 'foo'}} static_assert(bar(A{})); // expected-error {{no matching function for call to 'bar'}}