Commit 7888350f by Jason Merrill Committed by Jason Merrill

re PR c++/50157 ([C++0x] Non-silent SFINAE in new expression with explicit conversion)

	PR c++/50157
	* call.c (convert_like_real): Exit early if bad and !tf_error.

From-SVN: r178081
parent a02f398d
2011-08-25 Jason Merrill <jason@redhat.com>
PR c++/50157
* call.c (convert_like_real): Exit early if bad and !tf_error.
2011-08-23 Jason Merrill <jason@redhat.com>
* typeck2.c (build_functional_cast): Don't try to avoid calling
......
......@@ -5642,6 +5642,9 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
diagnostic_t diag_kind;
int flags;
if (convs->bad_p && !(complain & tf_error))
return error_mark_node;
if (convs->bad_p
&& convs->kind != ck_user
&& convs->kind != ck_list
......@@ -5688,15 +5691,12 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
else if (t->kind == ck_identity)
break;
}
if (complain & tf_error)
{
permerror (input_location, "invalid conversion from %qT to %qT", TREE_TYPE (expr), totype);
if (fn)
permerror (DECL_SOURCE_LOCATION (fn),
" initializing argument %P of %qD", argnum, fn);
}
else
return error_mark_node;
permerror (input_location, "invalid conversion from %qT to %qT",
TREE_TYPE (expr), totype);
if (fn)
permerror (DECL_SOURCE_LOCATION (fn),
" initializing argument %P of %qD", argnum, fn);
return cp_convert (totype, expr);
}
......
2011-08-25 Jason Merrill <jason@redhat.com>
PR c++/50157
* g++.dg/cpp0x/sfinae27.C: New.
2011-08-25 Tobias Burnus <burnus@net-b.de>
* gfortran.dg/coarray_lib_token_4.f90: New.
......
// PR c++/50157
// { dg-options -std=c++0x }
template<class T>
T val();
template<class T, class Arg, class =
decltype(::new T(val<Arg>()))
>
auto test(int) -> char;
template<class, class>
auto test(...) -> char (&)[2];
struct P {
explicit operator bool(); // (#13)
};
typedef decltype(test<bool, P>(0)) type; // OK
typedef decltype(test<float, P>(0)) type2; // Error (#17)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment