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: next enum bit



Brenan --

  Here's a patch for part of the problem, which has nothing to do with
templates.  Even the C front-end will crash on (the illegal):

  enum E { a, b = (enum E) a };

Jeff, OK?

-- 
Mark Mitchell 			mark@markmitchell.com
Mark Mitchell Consulting	http://www.markmitchell.com

Fri Aug 28 12:52:18 1998  Mark Mitchell  <mark@markmitchell.com>

	* convert.c (convert_to_integer): Issue an error on conversions to
	incomplete types.

Index: convert.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/convert.c,v
retrieving revision 1.4
diff -c -p -r1.4 convert.c
*** convert.c	1998/05/06 04:53:40	1.4
--- convert.c	1998/08/28 19:49:32
*************** convert_to_integer (type, expr)
*** 121,126 ****
--- 121,134 ----
    int inprec = TYPE_PRECISION (intype);
    int outprec = TYPE_PRECISION (type);
  
+   /* An INTEGER_TYPE cannot be incomplete, but an ENUMERAL_TYPE can
+      be.  Consider `enum E = { a, b = (enum E) 3 };'.  */
+   if (!TYPE_SIZE (type))
+     {
+       error ("conversion to incomplete type");
+       return error_mark_node;
+     }
+ 
    switch (TREE_CODE (intype))
      {
      case POINTER_TYPE:


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