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 g++-980308: New problem with template template parameters :-(


Bernd Nottelmann wrote:
> 
> Hi,
> 
> I have applied your (Kriang´s) patch and the example program
> which I sent compiles fine. But now I have a new problem -
> it is relating to mixing of template template parameters and
> the member template feature of the new g++. Here is the example
> code:
> 
(code removed)

Hi,

Thanks.  Here is a patch that fix the problem.  I forgot the 
'Build don't link' string in the test case of my last patch.  So this
patch will correct that as well.

--Kriang


	* pt.c (reduce_template_parm_level): Also copy 
	the DECL_TEMPLATE_PARMS field.


diff -cprN gcc/cp/pt.c gcc-new/cp/pt.c
*** gcc/cp/pt.c	Wed Mar 11 20:20:02 1998
--- gcc-new/cp/pt.c	Wed Mar 11 20:18:48 1998
*************** reduce_template_parm_level (index, type,
*** 1092,1097 ****
--- 1092,1101 ----
  				     TEMPLATE_PARM_ORIG_LEVEL (index),
  				     decl, type);
        TEMPLATE_PARM_DESCENDANTS (index) = t;
+ 
+       /* Template template parameters need this.  */
+       DECL_TEMPLATE_PARMS (decl)
+ 	= DECL_TEMPLATE_PARMS (TEMPLATE_PARM_DECL (index));
      }
  
    return TEMPLATE_PARM_DESCENDANTS (index);
diff -cprN gcc/testsuite/g++.old-deja/g++.pt/ttp43.C
gcc-new/testsuite/g++.old-deja/g++.pt/ttp43.C
*** gcc/testsuite/g++.old-deja/g++.pt/ttp43.C	Tue Mar 10 19:09:10 1998
--- gcc-new/testsuite/g++.old-deja/g++.pt/ttp43.C	Wed Mar 11 20:16:41
1998
***************
*** 1,3 ****
--- 1,5 ----
+ // Build don't link:
+ 
  template < class T, template <class> class E1, template <class> class
E2 >
  struct Add {
    Add(const E1<T>& e1, const E2<T>& e2) {}
diff -cprN gcc/testsuite/g++.old-deja/g++.pt/ttp44.C
gcc-new/testsuite/g++.old-deja/g++.pt/ttp44.C
*** gcc/testsuite/g++.old-deja/g++.pt/ttp44.C	Wed Dec 31 16:00:00 1969
--- gcc-new/testsuite/g++.old-deja/g++.pt/ttp44.C	Wed Mar 11 20:17:47
1998
***************
*** 0 ****
--- 1,17 ----
+ // Build don't link:
+ 
+ template < class T, template < class > class E1, template < class >
class E2 >
+ class Add {
+ public:
+   Add(const E1<T>& e1, const E2<T>& e2) {}
+ };
+ 
+ template < class T >
+ struct Id {
+   template < template < class > class E >
+   Add < T, Id, E > operator+(const E<T>& e) const {
+     return Add < T, Id, E >(*this, e);
+   }
+ };
+ 
+ template struct Id<double>;


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