This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: template breakage
- To: jason at cygnus dot com
- Subject: Re: template breakage
- From: Mark Mitchell <mark at markmitchell dot com>
- Date: Thu, 28 May 1998 15:41:54 -0700
- CC: g++-local at cygnus dot com, egcs-patches at cygnus dot com
- References: <199805280710.AAA16131@yorick.cygnus.com>
- Reply-to: mark at markmitchell dot com
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);
}