+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
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
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.
--- /dev/null
+// 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)