This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: ICE
- To: christoph dot moar at mchp dot siemens dot de
- Subject: Re: ICE
- From: Martin von Loewis <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Mon, 6 Jul 1998 09:46:55 +0200
- CC: egcs-bugs at cygnus dot com, egcs-patches at cygnus dot com
- References: <3.0.5.32.19980703105357.0091f3b0@mail-o.mchp.siemens.de>
> test.cc:12: Internal compiler error.
> test.cc:12: Please submit a full bug report to `egcs-bugs@cygnus.com'.
>
> (line 12 is the first static const Time declaration).
Christoph,
Thanks for your bug report. Your program is in error, but g++ should
not crash. Here is a fix.
Martin
1998-07-06 Martin von Löwis <loewis@informatik.hu-berlin.de>
* typeck2.c (digest_init): Do not crash if init is a list.
--- /dev/null Mon Jul 18 01:46:18 1994
+++ g++.other/static2.C Mon Jul 6 09:33:55 1998
@@ -0,0 +1,9 @@
+//Build don't link:
+struct X{
+ X(int,int);
+};
+
+struct Y{
+ static const X a(1,2); // ERROR - static member with initializer
+};
+
Index: typeck2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/typeck2.c,v
retrieving revision 1.26
diff -c -p -r1.26 typeck2.c
*** typeck2.c 1998/06/22 05:59:22 1.26
--- typeck2.c 1998/07/06 07:43:26
*************** digest_init (type, init, tail)
*** 882,887 ****
--- 882,892 ----
}
else if (raw_constructor)
return process_init_constructor (type, init, (tree *)0);
+ else if (TREE_CODE (init) == TREE_LIST)
+ /* This must be an error, like
+ static Foo bar(init1, init2);
+ */
+ return init;
else if (can_convert_arg (type, TREE_TYPE (init), init)
|| TYPE_NON_AGGREGATE_CLASS (type))
/* These are never initialized from multiple constructor elements. */;