Patch for better diagnostic (was: Re: Bug in MI?)
Manfred Hollstein
manfred@s-direktnet.de
Fri Mar 6 02:22:00 GMT 1998
On Fri, 6 March 1998, 10:27:21, manfred@s-direktnet.de wrote:
> According to C++WP 10.3 [class.virtual], the `final overrider' is
> missing, hence the program is ill-formed!
>
> But, gcc's error message is IMHO absolutely misleading.
How about this patch?
BTW, how about adding references to the language definition?
IMHO, a `see [10.3 class.virtual]' would have helped me a lot ;-)
Fri Mar 6 11:05:03 1998 Manfred Hollstein <manfred@s-direktnet.de>
* typeck2.c (abstract_virtuals_error): Give a better
diagnostic for the special case `virtual base classes'.
diff -up egcs-1.0.2.orig/gcc/cp/typeck2.c egcs-1.0.2/gcc/cp/typeck2.c
--- egcs-1.0.2.orig/gcc/cp/typeck2.c Thu Nov 27 07:47:02 1997
+++ egcs-1.0.2/gcc/cp/typeck2.c Thu Nov 27 07:47:02 1997
@@ -155,7 +155,14 @@ abstract_virtuals_error (decl, type)
/* Only go through this once. */
if (TREE_PURPOSE (u) == NULL_TREE)
{
- error (" since the following virtual functions are abstract:");
+ /* In class.c:override_one_vtable we might have marked this as a
+ class with abstract methods; in fact, it is a class with
+ virtual base classes for which not all virtual methods
+ have been overridden. */
+ if (u == error_mark_node)
+ error (" since the following virtual functions are not finally overridden:");
+ else
+ error (" since the following virtual functions are abstract:");
TREE_PURPOSE (u) = error_mark_node;
while (u)
{
@@ -163,7 +170,13 @@ abstract_virtuals_error (decl, type)
u = TREE_CHAIN (u);
}
}
- else cp_error (" since type `%T' has abstract virtual functions", type);
+ else
+ {
+ if (u == error_mark_node)
+ cp_error (" since type `%T' has virtual functions", type);
+ else
+ cp_error (" since type `%T' has abstract virtual functions", type);
+ }
}
/* Print an error message for invalid use of a signature type.
More information about the Gcc-bugs
mailing list