re PR c++/41468 (SFINAE for expressions doesn't consider ambiguous conversion sequences)

PR c++/41468
	* call.c (convert_like_real) [ck_ambig]: Just return error_mark_node
	if we don't want errors.

From-SVN: r158799
This commit is contained in:
Jason Merrill 2010-04-27 15:04:23 -04:00 committed by Jason Merrill
parent 798ec80703
commit 4a5d353fa8
4 changed files with 17 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2010-04-27 Jason Merrill <jason@redhat.com>
PR c++/41468
* call.c (convert_like_real) [ck_ambig]: Just return error_mark_node
if we don't want errors.
PR c++/41468
* class.c (convert_to_base): Add complain parameter. Pass
ba_quiet to lookup_base if we don't want errors.

View File

@ -4947,6 +4947,8 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
}
return expr;
case ck_ambig:
if (!(complain & tf_error))
return error_mark_node;
/* Call build_user_type_conversion again for the error. */
return build_user_type_conversion
(totype, convs->u.expr, LOOKUP_NORMAL);

View File

@ -2,6 +2,7 @@
PR c++/41468
* g++.dg/template/sfinae17.C: New.
* g++.dg/template/sfinae18.C: New.
2010-04-27 Fabien Chêne <fabien.chene@gmail.com>

View File

@ -0,0 +1,10 @@
// PR c++/41468
typedef int Ft(int);
struct A { operator Ft*(); };
struct B { operator Ft*(); };
struct C : A, B { };
template<typename C> void f(int (*a)[sizeof(C()(0))]);
template<typename C> void f(...);
int main() { f<C>(0); }