1 // RUN:  %clang_cc1 -std=c++2a -verify %s
2 // RUN:  %clang_cc1 -std=c++2a -verify %s -fno-concept-satisfaction-caching -DNO_CACHE
3 // expected-no-diagnostics
4 
5 template<typename T>
6 concept C = (f(T()), true);
7 
8 template<typename T>
foo()9 constexpr bool foo() { return false; }
10 
11 template<typename T>
f(T ())12   requires (f(T()), true)
13 constexpr bool foo() requires (f(T()), true) { return true; }
14 
15 namespace a {
16   struct A {};
17   void f(A a);
18 }
19 
20 static_assert(C<a::A>);
21 static_assert(foo<a::A>());
22 
23 namespace a {
24   // This makes calls to f ambiguous, but the second check will still succeed
25   // because the constraint satisfaction results are cached.
26   void f(A a, int = 2);
27 }
28 #ifdef NO_CACHE
29 static_assert(!C<a::A>);
30 static_assert(!foo<a::A>());
31 #else
32 static_assert(C<a::A>);
33 static_assert(foo<a::A>());
34 #endif