gcc internal error for reserved symbols
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Mon Feb 14 01:49:00 GMT 2000
> the code below gives an internal compiler error with g++ 2.95.2. I
> know that g++ reserves a bunch of symbols that start with two
> underscores but a descriptive error message would be an improvement.
Thanks for your bug report. With the patch below, gcc reports
b.cc:3: declaration of `operator(sizeof)' as non-function
b.cc:3: assignment (not initialization) in declaration
which was what it wanted to report all along.
Regards,
Martin
2000-02-14 Martin v. Löwis <loewis@informatik.hu-berlin.de>
* lex.c (init_parse): Add SIZEOF_EXPR to opname_tab.
// Build don't link:
void foo ()
{
int __sz = 0; // ERROR - reserved name
}
Index: lex.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/lex.c,v
retrieving revision 1.175
diff -u -r1.175 lex.c
--- lex.c 2000/02/07 20:36:33 1.175
+++ lex.c 2000/02/14 09:34:32
@@ -844,6 +844,7 @@
opname_tab[(int) POSTDECREMENT_EXPR] = "--";
opname_tab[(int) POSTINCREMENT_EXPR] = "++";
opname_tab[(int) COMPOUND_EXPR] = ",";
+ opname_tab[(int) SIZEOF_EXPR] = "(sizeof)";
assignop_tab[(int) NOP_EXPR] = "=";
assignop_tab[(int) PLUS_EXPR] = "+=";
More information about the Gcc-bugs
mailing list