| Submitter | Jakub Jelinek |
|---|---|
| Date | June 22, 2010, 1:52 p.m. |
| Message ID | <20100622135234.GS7811@tyan-ft48-01.lab.bos.redhat.com> |
| Download | mbox | patch |
| Permalink | /patch/56500/ |
| State | New |
| Headers | show |
Comments
On 06/22/2010 09:52 AM, Jakub Jelinek wrote: > + mark_exp_read (datum); > + mark_exp_read (component); The datum is used as an lvalue, and the component as an rvalue. Jason
Patch
--- gcc/cp/typeck2.c.jj 2010-06-20 16:36:49.000000000 +0200 +++ gcc/cp/typeck2.c 2010-06-22 12:28:34.000000000 +0200 @@ -1478,6 +1478,9 @@ build_m_component_ref (tree datum, tree if (error_operand_p (datum) || error_operand_p (component)) return error_mark_node; + mark_exp_read (datum); + mark_exp_read (component); + ptrmem_type = TREE_TYPE (component); if (!TYPE_PTR_TO_MEMBER_P (ptrmem_type)) { --- gcc/testsuite/g++.dg/warn/Wunused-var-13.C.jj 2010-06-22 12:30:04.000000000 +0200 +++ gcc/testsuite/g++.dg/warn/Wunused-var-13.C 2010-06-22 08:20:23.000000000 +0200 @@ -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; +}