OSDN Git Service

PR c++/28996
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 9 Sep 2006 22:26:53 +0000 (22:26 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 9 Sep 2006 22:26:53 +0000 (22:26 +0000)
        * cvt.c (convert_to_void): Strip COMPONENT_REF to functions.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116800 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/cvt.c
gcc/testsuite/g++.dg/warn/noeffect8.C

index 6e20eb1..f565f4c 100644 (file)
@@ -1,3 +1,8 @@
+2006-09-09  Jason Merrill  <jason@redhat.com>
+
+       PR c++/28996
+       * cvt.c (convert_to_void): Strip COMPONENT_REF to functions.
+
 2006-09-08  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        PR c++/28858
index fea5768..6f61218 100644 (file)
@@ -927,9 +927,13 @@ convert_to_void (tree expr, const char *implicit)
        expr = void_zero_node;
       }
     else if (implicit && probe == expr && is_overloaded_fn (probe))
-      /* Only warn when there is no &.  */
-      warning (0, "%s is a reference, not call, to function %qE",
-                 implicit, expr);
+      {
+       /* Only warn when there is no &.  */
+       warning (0, "%s is a reference, not call, to function %qE",
+                implicit, expr);
+       if (TREE_CODE (expr) == COMPONENT_REF)
+         expr = TREE_OPERAND (expr, 0);
+      }
   }
 
   if (expr != error_mark_node && !VOID_TYPE_P (TREE_TYPE (expr)))
index 99d3688..4eb7f1b 100644 (file)
@@ -1,4 +1,4 @@
-// PR c++/26696
+// PR c++/26696, 28996
 
 struct A
 {
@@ -9,4 +9,5 @@ int main()
 {
   A a; 
   a.f;                         // { dg-warning "not call" }
+  A().f;                       // { dg-warning "not call" }
 }