aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-08-25 14:22:46 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-08-25 14:22:46 -0400
commit7888350f3973a45d98581573bcf7773eb10d8322 (patch)
tree2fe451bcda29357f54357a66fa82d0a648c6100c /gcc/cp
parenta02f398da4c49e7c9f6fc8bed2da4edcf9b834a8 (diff)
downloadgcc-7888350f3973a45d98581573bcf7773eb10d8322.zip
gcc-7888350f3973a45d98581573bcf7773eb10d8322.tar.gz
gcc-7888350f3973a45d98581573bcf7773eb10d8322.tar.bz2
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
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/call.c18
2 files changed, 14 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 390a798..92363ff 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+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
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index e5f65b3..d911b3a 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -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);
}