This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ICE


> 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.  */;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]