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
This commit is contained in:
Jakub Jelinek 2010-06-22 22:50:03 +02:00 committed by Jakub Jelinek
parent dd6f4f897e
commit 87867ff656
4 changed files with 32 additions and 0 deletions

View File

@ -1,5 +1,9 @@
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.

View File

@ -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))
{

View File

@ -1,5 +1,8 @@
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.

View File

@ -0,0 +1,22 @@
// 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;
}