From 12b03642cb027437f4a0eddac8c7fd7849bfe149 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 26 Sep 2011 11:47:17 -0400 Subject: re PR c++/50523 (C++ FE apparently incorrectly rejects tramp3d) PR c++/50523 * call.c (implicit_conversion): Mask out inappropriate LOOKUP flags at the top of the function. From-SVN: r179203 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/call.c | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'gcc/cp') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 59b162d..865d764 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-09-26 Jason Merrill + PR c++/50523 + * call.c (implicit_conversion): Mask out inappropriate LOOKUP + flags at the top of the function. + * pt.c (tsubst_copy) [PARM_DECL]: Handle 'this' in NSDMI. 2011-09-26 Paolo Carlini diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 6a7dfd3..579e563 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -1660,6 +1660,12 @@ implicit_conversion (tree to, tree from, tree expr, bool c_cast_p, || expr == error_mark_node) return NULL; + /* Other flags only apply to the primary function in overload + resolution, or after we've chosen one. */ + flags &= (LOOKUP_ONLYCONVERTING|LOOKUP_NO_CONVERSION|LOOKUP_COPY_PARM + |LOOKUP_NO_TEMP_BIND|LOOKUP_NO_RVAL_BIND|LOOKUP_PREFER_RVALUE + |LOOKUP_NO_NARROWING|LOOKUP_PROTECT); + if (TREE_CODE (to) == REFERENCE_TYPE) conv = reference_binding (to, from, expr, c_cast_p, flags); else @@ -1716,15 +1722,13 @@ implicit_conversion (tree to, tree from, tree expr, bool c_cast_p, && (flags & LOOKUP_NO_CONVERSION) == 0) { struct z_candidate *cand; - int convflags = (flags & (LOOKUP_NO_TEMP_BIND|LOOKUP_ONLYCONVERTING - |LOOKUP_NO_NARROWING)); if (CLASS_TYPE_P (to) && BRACE_ENCLOSED_INITIALIZER_P (expr) && !CLASSTYPE_NON_AGGREGATE (complete_type (to))) return build_aggr_conv (to, expr, flags); - cand = build_user_type_conversion_1 (to, expr, convflags); + cand = build_user_type_conversion_1 (to, expr, flags); if (cand) conv = cand->second_conv; -- cgit v1.1