PATCH for enum/template interaction
Mark Mitchell
mark@markmitchell.com
Sat Jun 13 23:13:00 GMT 1998
Here's a patch that makes us not issue bogus errors on the following
testcase. Jason, OK?
--
Mark Mitchell mark@markmitchell.com
Mark Mitchell Consulting http://www.markmitchell.com
1998-06-13 Mark Mitchell <mark@markmitchell.com>
* pt.c (for_each_template_parm): Traverse the TYPE_CONTEXT for
types.
Index: testsuite/g++.old-deja/g++.pt/enum4.C
===================================================================
RCS file: enum4.C
diff -N enum4.C
*** /dev/null Mon Dec 31 20:00:00 1979
--- enum4.C Sat Jun 13 22:50:19 1998
***************
*** 0 ****
--- 1,16 ----
+ // Build don't link:
+
+ template <class T>
+ struct U
+ {
+ T mT;
+ };
+
+ template <class H>
+ struct M
+ {
+ enum FLAG {On, Off};
+ U<FLAG> mUF;
+ };
+
+ M<char> gm;
Index: cp/pt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/pt.c,v
retrieving revision 1.155
diff -c -p -r1.155 pt.c
*** pt.c 1998/06/12 12:56:22 1.155
--- pt.c 1998/06/14 05:49:44
*************** for_each_template_parm (t, fn, data)
*** 3164,3169 ****
--- 3164,3174 ----
{
if (!t)
return 0;
+
+ if (TREE_CODE_CLASS (TREE_CODE (t)) == 't'
+ && for_each_template_parm (TYPE_CONTEXT (t), fn, data))
+ return 1;
+
switch (TREE_CODE (t))
{
case INDIRECT_REF:
More information about the Gcc-patches
mailing list