Commit 38f1276b by Jason Merrill Committed by Jason Merrill

semantics.c (finish_qualified_id_expr): Use maybe_dummy_object rather than…

semantics.c (finish_qualified_id_expr): Use maybe_dummy_object rather than checking current_class_ref directly.

	* semantics.c (finish_qualified_id_expr): Use maybe_dummy_object
	rather than checking current_class_ref directly.
	(finish_call_expr): Likewise.

From-SVN: r158808
parent a6846853
2010-04-27 Jason Merrill <jason@redhat.com> 2010-04-27 Jason Merrill <jason@redhat.com>
* semantics.c (finish_qualified_id_expr): Use maybe_dummy_object
rather than checking current_class_ref directly.
(finish_call_expr): Likewise.
PR c++/43856 PR c++/43856
* name-lookup.c (qualify_lookup): Disqualify lambda op(). * name-lookup.c (qualify_lookup): Disqualify lambda op().
* class.c (current_nonlambda_class_type): New fn. * class.c (current_nonlambda_class_type): New fn.
......
...@@ -1690,6 +1690,7 @@ finish_qualified_id_expr (tree qualifying_class, ...@@ -1690,6 +1690,7 @@ finish_qualified_id_expr (tree qualifying_class,
else if (BASELINK_P (expr) && !processing_template_decl) else if (BASELINK_P (expr) && !processing_template_decl)
{ {
tree fns; tree fns;
tree ob;
/* See if any of the functions are non-static members. */ /* See if any of the functions are non-static members. */
fns = BASELINK_FUNCTIONS (expr); fns = BASELINK_FUNCTIONS (expr);
...@@ -1697,10 +1698,10 @@ finish_qualified_id_expr (tree qualifying_class, ...@@ -1697,10 +1698,10 @@ finish_qualified_id_expr (tree qualifying_class,
fns = TREE_OPERAND (fns, 0); fns = TREE_OPERAND (fns, 0);
/* If so, the expression may be relative to 'this'. */ /* If so, the expression may be relative to 'this'. */
if (!shared_member_p (fns) if (!shared_member_p (fns)
&& current_class_ref && (ob = maybe_dummy_object (qualifying_class, NULL),
&& DERIVED_FROM_P (qualifying_class, TREE_TYPE (current_class_ref))) !is_dummy_object (ob)))
expr = (build_class_member_access_expr expr = (build_class_member_access_expr
(maybe_dummy_object (qualifying_class, NULL), (ob,
expr, expr,
BASELINK_ACCESS_BINFO (expr), BASELINK_ACCESS_BINFO (expr),
/*preserve_reference=*/false, /*preserve_reference=*/false,
...@@ -2002,31 +2003,18 @@ finish_call_expr (tree fn, VEC(tree,gc) **args, bool disallow_virtual, ...@@ -2002,31 +2003,18 @@ finish_call_expr (tree fn, VEC(tree,gc) **args, bool disallow_virtual,
. operator.... [Otherwise] a contrived object of type T . operator.... [Otherwise] a contrived object of type T
becomes the implied object argument. becomes the implied object argument.
This paragraph is unclear about this situation: In this situation:
struct A { void f(); }; struct A { void f(); };
struct B : public A {}; struct B : public A {};
struct C : public A { void g() { B::f(); }}; struct C : public A { void g() { B::f(); }};
In particular, for `B::f', this paragraph does not make clear "the class of that member function" refers to `A'. But 11.2
whether "the class of that member function" refers to `A' or [class.access.base] says that we need to convert 'this' to B* as
to `B'. We believe it refers to `B'. */ part of the access, so we pass 'B' to maybe_dummy_object. */
if (current_class_type
&& DERIVED_FROM_P (BINFO_TYPE (BASELINK_ACCESS_BINFO (fn)),
current_class_type)
&& current_class_ref)
object = maybe_dummy_object (BINFO_TYPE (BASELINK_ACCESS_BINFO (fn)),
NULL);
else
{
tree representative_fn;
representative_fn = BASELINK_FUNCTIONS (fn); object = maybe_dummy_object (BINFO_TYPE (BASELINK_ACCESS_BINFO (fn)),
if (TREE_CODE (representative_fn) == TEMPLATE_ID_EXPR) NULL);
representative_fn = TREE_OPERAND (representative_fn, 0);
representative_fn = get_first_fn (representative_fn);
object = build_dummy_object (DECL_CONTEXT (representative_fn));
}
if (processing_template_decl) if (processing_template_decl)
{ {
......
...@@ -10,6 +10,7 @@ struct S1 { ...@@ -10,6 +10,7 @@ struct S1 {
[=]() { [=]() {
i; i;
g(); g();
S1::g();
operator()(42); operator()(42);
}; };
} }
......
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