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
This commit is contained in:
Jason Merrill 2006-09-09 18:26:53 -04:00 committed by Jason Merrill
parent 8b649f3f12
commit 05f8c2d5f6
3 changed files with 14 additions and 4 deletions

View 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

View 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)))

View 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" }
}