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:
parent
dd6f4f897e
commit
87867ff656
@ -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.
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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.
|
||||
|
||||
|
22
gcc/testsuite/g++.dg/warn/Wunused-var-13.C
Normal file
22
gcc/testsuite/g++.dg/warn/Wunused-var-13.C
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user