This is the mail archive of the gcc-bugs@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]

PATCH for main-trunck-g++: a template regression



Max --

  Here's a patch for your problem:

    template<class P> struct B
    {
      template<class T> void f(T& t) { t = T(); }
    };

    enum ptype { t1, t2};

    struct D : public B<ptype>
    {
      void g(double& d) { f(d); }
    };


    D d;

  Jason, may I check this in?

-- 
Mark Mitchell <mmitchell@usa.net>
http://home.earthlink.net/~mbmitchell
Consulting Services Available

Sun Mar  8 10:39:39 1998  Mark Mitchell  <mmitchell@usa.net>

	* pt.c (tsubst): Clear TYPE_REFERENCE_TO when creating a
	reduced-level template type parameter.

Index: pt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/pt.c,v
retrieving revision 1.88
diff -c -p -r1.88 pt.c
*** pt.c	1998/03/04 11:32:59	1.88
--- pt.c	1998/03/08 18:40:51
*************** tsubst (t, args, in_decl)
*** 3528,3533 ****
--- 3528,3534 ----
  	    TYPE_STUB_DECL (r) = TYPE_NAME (r) = TEMPLATE_TYPE_DECL (r);
  	    TYPE_MAIN_VARIANT (r) = r;
  	    TYPE_POINTER_TO (r) = NULL_TREE;
+ 	    TYPE_REFERENCE_TO (r) = NULL_TREE;
  	    break;
  
  	  case TEMPLATE_PARM_INDEX:
Index: memtemp72.C
===================================================================
RCS file: memtemp72.C
diff -N memtemp72.C
*** /dev/null	Mon Dec 31 20:00:00 1979
--- memtemp72.C	Sun Mar  8 10:41:37 1998
***************
*** 0 ****
--- 1,17 ----
+ // Build don't link:
+ 
+ template<class P> struct B
+ {
+   template<class T> void f(T& t) { t = T(); }
+ };
+ 
+ enum ptype { t1, t2};
+ 
+ struct D : public B<ptype>
+ {
+   void g(double& d) { f(d); }
+ };
+ 
+ 
+ D d;
+  


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