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]

C++ PATCH: ice on duplicate defns


Hi,
I've applied the attached patch and test case, originally sent as
http://egcs.cygnus.com/ml/gcc-patches/1999-06/msg00109.html.
Since then, 
	1999-07-09  Michael Tiemann  <tiemann@happy.cygnus.com>
fixed part of the problem. This tidies up the rest.

nathan
-- 
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
        I have seen the death of PhotoShop -- it is called GIMP
nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk
Index: egcs/gcc/cp/ChangeLog
===================================================================
RCS file: /cvs/egcs/egcs/gcc/cp/ChangeLog,v
retrieving revision 1.1160
diff -c -3 -p -r1.1160 ChangeLog
*** ChangeLog	1999/08/03 14:24:01	1.1160
--- ChangeLog	1999/08/03 14:33:39
***************
*** 1,5 ****
--- 1,9 ----
  1999-08-03  Nathan Sidwell  <nathan@acm.org>
  
+ 	* class.c (duplicate_tag_error): Preserve template information.
+ 
+ 1999-08-03  Nathan Sidwell  <nathan@acm.org>
+ 
  	* decl.c (start_enum): Show location of previous definition.
  	* parse.y (enumlist_opt): New reduction.
  	(structsp): Simplify enum rules to use enumlist_opt.
Index: egcs/gcc/cp/class.c
===================================================================
RCS file: /cvs/egcs/egcs/gcc/cp/class.c,v
retrieving revision 1.170
diff -c -3 -p -r1.170 class.c
*** class.c	1999/08/02 22:59:03	1.170
--- class.c	1999/08/03 14:33:46
*************** duplicate_tag_error (t)
*** 2205,2210 ****
--- 2205,2212 ----
        tree binfo = TYPE_BINFO (t);
        int interface_only = CLASSTYPE_INTERFACE_ONLY (t);
        int interface_unknown = CLASSTYPE_INTERFACE_UNKNOWN (t);
+       tree template_info = CLASSTYPE_TEMPLATE_INFO (t);
+       int use_template = CLASSTYPE_USE_TEMPLATE (t);
  
        bzero ((char *) TYPE_LANG_SPECIFIC (t), sizeof (struct lang_type));
        BINFO_BASETYPES(binfo) = NULL_TREE;
*************** duplicate_tag_error (t)
*** 2213,2218 ****
--- 2215,2222 ----
        CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
        SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, interface_unknown);
        TYPE_REDEFINED (t) = 1;
+       CLASSTYPE_TEMPLATE_INFO (t) = template_info;
+       CLASSTYPE_USE_TEMPLATE (t) = use_template;
      }
    TYPE_SIZE (t) = NULL_TREE;
    TYPE_MODE (t) = VOIDmode;
Index: egcs/gcc/testsuite/ChangeLog
===================================================================
RCS file: /cvs/egcs/egcs/gcc/testsuite/ChangeLog,v
retrieving revision 1.302
diff -c -3 -p -r1.302 ChangeLog
*** ChangeLog	1999/08/03 14:25:08	1.302
--- ChangeLog	1999/08/03 14:35:11
***************
*** 1,5 ****
--- 1,9 ----
  1999-08-03  Nathan Sidwell  <nathan@acm.org>
  
+ 	* g++.old-deja/g++.other/struct1.C: New test.
+ 
+ 1999-08-03  Nathan Sidwell  <nathan@acm.org>
+ 
  	* g++.old-deja/g++.other/enum2.C: New test.
  
  Mon Aug  2 13:35:12 1999  Richard Henderson  <rth@cygnus.com>
Index: egcs/gcc/testsuite/g++.old-deja/g++.other/struct1.C
===================================================================
RCS file: struct1.C
diff -N struct1.C
*** /dev/null	Sat Dec  5 20:30:03 1998
--- struct1.C	Tue Aug  3 07:35:11 1999
***************
*** 0 ****
--- 1,42 ----
+ // Build don't link:
+ 
+ // Copyright (C) 1999 Free Software Foundation, Inc.
+ // Contributed by Nathan Sidwell 3 Jun 1999 <nathan@acm.org>
+ 
+ // Duplicate definitions are wrong, we should just cough
+ // politely, but we used to die horribly.
+ 
+ class Y
+ {   // ERROR - previous definition
+ };
+ class Y
+ {   // ERROR - redefinition
+ };
+ 
+ template<class T> class X
+ {   // ERROR - previous definition
+ };
+ template<class T> class X
+ {   // ERROR - redefinition
+ };
+ 
+ template<class T> class X<T *>
+ {   // ERROR - previous definition
+ };
+ template<class T> class X<T *>
+ {   // ERROR - redefinition
+ };
+ 
+ template<> class X<int>
+ {   // ERROR - previous definition
+ };
+ template<> class X<int>
+ {   // ERROR - redefinition
+ };
+ 
+ template<> class X<int *>
+ {   // ERROR - previous definition
+ };
+ template<> class X<int *>
+ {   // ERROR - redefinition
+ };

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