Commit e1926435 by Jason Merrill Committed by Jason Merrill

DR 2007

	DR 2007
	* call.c (build_new_op_1): Don't do non-class lookup for =, -> or [].

From-SVN: r217275
parent 9ab4c07a
2014-11-09 Jason Merrill <jason@redhat.com>
DR 2007
* call.c (build_new_op_1): Don't do non-class lookup for =, -> or [].
2014-11-07 Jason Merrill <jason@redhat.com>
DR 1558
......
......@@ -5309,6 +5309,7 @@ build_new_op_1 (location_t loc, enum tree_code code, int flags, tree arg1,
arg1 = prep_operand (arg1);
bool memonly = false;
switch (code)
{
case NEW_EXPR:
......@@ -5340,6 +5341,16 @@ build_new_op_1 (location_t loc, enum tree_code code, int flags, tree arg1,
code_orig_arg1 = TREE_CODE (TREE_TYPE (arg1));
code_orig_arg2 = TREE_CODE (TREE_TYPE (arg2));
break;
/* =, ->, [], () must be non-static member functions. */
case MODIFY_EXPR:
if (code2 != NOP_EXPR)
break;
case COMPONENT_REF:
case ARRAY_REF:
memonly = true;
break;
default:
break;
}
......@@ -5369,7 +5380,9 @@ build_new_op_1 (location_t loc, enum tree_code code, int flags, tree arg1,
/* Add namespace-scope operators to the list of functions to
consider. */
add_candidates (lookup_function_nonclass (fnname, arglist, /*block_p=*/true),
if (!memonly)
add_candidates (lookup_function_nonclass (fnname, arglist,
/*block_p=*/true),
NULL_TREE, arglist, NULL_TREE,
NULL_TREE, false, NULL_TREE, NULL_TREE,
flags, &candidates, complain);
......
// DR 2007
// We shouldn't instantiate A<void> to lookup operator=, since operator=
// must be a non-static member function.
template<typename T> struct A { typename T::error e; };
template<typename T> struct B { };
B<A<void> > b1, &b2 = (b1 = b1);
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