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
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.
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.
--- /dev/null
+// 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;
+}