Commit 87867ff6 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/44619 (Bogus set but not used warning when using pointer to member operators)

	PR c++/44619
	* typeck2.c (build_m_component_ref): Call mark_lvalue_use on
	datum and mark_rvalue_use on component.

	* g++.dg/warn/Wunused-var-13.C: New test.

From-SVN: r161230
parent dd6f4f89
2010-06-22 Jakub Jelinek <jakub@redhat.com>
PR c++/44619
* typeck2.c (build_m_component_ref): Call mark_lvalue_use on
datum and mark_rvalue_use on component.
PR c++/44627
* error.c (dump_expr): Don't look at CALL_EXPR_ARG (t, 0) if
the CALL_EXPR has no arguments.
......
......@@ -1478,6 +1478,9 @@ build_m_component_ref (tree datum, tree component)
if (error_operand_p (datum) || error_operand_p (component))
return error_mark_node;
mark_lvalue_use (datum);
mark_rvalue_use (component);
ptrmem_type = TREE_TYPE (component);
if (!TYPE_PTR_TO_MEMBER_P (ptrmem_type))
{
......
2010-06-22 Jakub Jelinek <jakub@redhat.com>
PR c++/44619
* g++.dg/warn/Wunused-var-13.C: New test.
PR c++/44627
* g++.dg/diagnostic/method1.C: New test.
......
// PR c++/44619
// { dg-do compile }
// { dg-options "-Wunused -W" }
struct S { int x, y; };
int
f1 ()
{
struct S p;
int S::*q = &S::x;
p.*q = 5;
return p.*q;
}
int
f2 (struct S *p, int S::*q)
{
struct S *r = p;
int S::*s = q;
return r->*s;
}
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