[patch] Fix PR c++/17456: Infinite loop after error in convert_to_void
Volker Reichelt
reichelt@igpm.rwth-aachen.de
Sat Dec 18 01:35:00 GMT 2004
When compiling the following invalid code snippet
========================================
struct A {};
struct B : A
{
void foo();
B() { foo; }
};
========================================
the 3.3-branch compiler gets into a memory-eating infinite loop after
issuing a sensible error message. The following patch fixes that by
setting expr to void_zero_node after the failure (like 3.4 branch
and mainline).
Bootstrapped and regtested on the 3.3 branch (i686-pc-linux-gnu).
Gaby, ok to commit?
Regards,
Volker
2004-12-16 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
* cvt.c (convert_to_void): Set expr to void_zero_node after
overload failure.
Index: gcc/gcc/cp/cvt.c
===================================================================
--- gcc/gcc/cp/cvt.c 23 Feb 2004 12:50:50 -0000 1.126.2.4
+++ gcc/gcc/cp/cvt.c 17 Dec 2004 23:36:48 -0000
@@ -903,6 +903,7 @@ convert_to_void (expr, implicit)
of an overloaded function, and this is not one of them. */
pedwarn ("%s cannot resolve address of overloaded function",
implicit ? implicit : "void cast");
+ expr = void_zero_node;
}
else if (implicit && probe == expr && is_overloaded_fn (probe))
/* Only warn when there is no &. */
===================================================================
More information about the Gcc-patches
mailing list