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: template breakage




Jason --

  On a related note, here a small patch for decl.c.  OK?

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

1998-05-28  Mark Mitchell  <mark@markmitchell.com>

	* decl.c (grokdeclarator): Don't complain about in-class
	initialization of static consts if we don't really know the type
	of the variable.

Index: static4.C
===================================================================
RCS file: static4.C
diff -N static4.C
*** /dev/null	Mon Dec 31 20:00:00 1979
--- static4.C	Thu May 28 15:35:56 1998
***************
*** 0 ****
--- 1,8 ----
+ // Build don't link:
+ 
+ template <class T>
+ struct S
+ {
+   static const T t = 3;
+ };
+ 
Index: decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.127
diff -c -p -r1.127 decl.c
*** decl.c	1998/05/28 01:44:26	1.127
--- decl.c	1998/05/28 22:37:02
*************** grokdeclarator (declarator, declspecs, d
*** 10003,10009 ****
  		  cp_error ("ANSI C++ forbids in-class initialization of non-const static member `%D'",
  			    declarator);
  		
! 		if (pedantic && ! INTEGRAL_TYPE_P (type))
  		  cp_pedwarn ("ANSI C++ forbids initialization of member constant `%D' of non-integral type `%T'", declarator, type);
  	      }
  
--- 10003,10010 ----
  		  cp_error ("ANSI C++ forbids in-class initialization of non-const static member `%D'",
  			    declarator);
  		
! 		if (pedantic && ! INTEGRAL_TYPE_P (type) 
! 		    && !uses_template_parms (type))
  		  cp_pedwarn ("ANSI C++ forbids initialization of member constant `%D' of non-integral type `%T'", declarator, type);
  	      }
  


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