Commit 05f8c2d5 by Jason Merrill Committed by Jason Merrill

re PR c++/28996 (ICE with statement forming unused static member function reference)

        PR c++/28996
        * cvt.c (convert_to_void): Strip COMPONENT_REF to functions.

From-SVN: r116800
parent 8b649f3f
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> 2006-09-08 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/28858 PR c++/28858
......
...@@ -927,9 +927,13 @@ convert_to_void (tree expr, const char *implicit) ...@@ -927,9 +927,13 @@ convert_to_void (tree expr, const char *implicit)
expr = void_zero_node; expr = void_zero_node;
} }
else if (implicit && probe == expr && is_overloaded_fn (probe)) 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", /* Only warn when there is no &. */
implicit, expr); 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))) if (expr != error_mark_node && !VOID_TYPE_P (TREE_TYPE (expr)))
......
// PR c++/26696 // PR c++/26696, 28996
struct A struct A
{ {
...@@ -9,4 +9,5 @@ int main() ...@@ -9,4 +9,5 @@ int main()
{ {
A a; A a;
a.f; // { dg-warning "not call" } a.f; // { dg-warning "not call" }
A().f; // { dg-warning "not call" }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment