diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-06-22 22:50:03 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-06-22 22:50:03 +0200 |
commit | 87867ff6566abe2217e4796873dd1efae6783707 (patch) | |
tree | fa44306b482a53bebe1bac5d740d4c86de5d8ae1 | |
parent | dd6f4f897e18adc7b60a3efe5e78c034e747cc22 (diff) | |
download | gcc-87867ff6566abe2217e4796873dd1efae6783707.zip gcc-87867ff6566abe2217e4796873dd1efae6783707.tar.gz gcc-87867ff6566abe2217e4796873dd1efae6783707.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/warn/Wunused-var-13.C | 22 |
4 files changed, 32 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3147918..95a7138 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 3d48c22..9526aba 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -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)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a954c9b..cfaa6cf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-13.C b/gcc/testsuite/g++.dg/warn/Wunused-var-13.C new file mode 100644 index 0000000..43df81d --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wunused-var-13.C @@ -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; +} |