2 // Verify we stop at the first bad argument conversion when considering a
3 // candidate during overload resolution.
6 struct A { typedef typename T::type type; };
9 // A conversion function that always induces a hard error when instantiated.
10 template<class T> B(T, typename A<T>::type = 0);
14 template<class T> void f(T, typename A<T>::type); // #1
15 template<class T> void f(T, T) const; // #2
17 static void g(int*, B); // #3
18 static void g(int, int); // #4
20 #if __cpp_ref_qualifiers
29 // The bad conversion for the 'this' argument should preclude us from further
30 // considering the non-const #1 (which would have caused a hard error during
31 // instantiation). This behavior is essentially DR 1391 extended to the
33 c.f(0, 0); // resolves to #2
36 // Likewise for the bad conversion for the 1st argument in #3.
37 C::g(42, 42); // resolves to #4
39 #if __cpp_ref_qualifiers
40 // Likewise for the bad 'this' conversion in #5.
41 C().h(0); // resolves to #6
46 // Test the same calls in a SFINAE context.
48 concept D = requires (const T t) {
50 t.template f<int>(0, 0);
57 // Test that when there's no strictly viable candidate and we're in a
58 // SFINAE context, we still stop at the first bad argument conversion.
60 concept E = requires { T().h(nullptr); };