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]
Other format: [Raw text]

C++ PATCH to convert_template_argument for c++/27424


In this bug, we fail to substitute into a template template argument because we didn't pass in all the template arguments of the surrounding template. It seems like the existing code in convert_template_argument tries to handle this case, but for some reason stripped all but the innermost set of arguments. Removing that stripping fixes the testcase, and doesn't break any tests.

Tested x86_64-pc-linux-gnu, applied to trunk.

2006-06-28  Jason Merrill  <jason@redhat.com>

	PR c++/27424
	* pt.c (convert_template_argument): Pass all template arguments 
	on to coerce_template_template_parms.

Index: pt.c
===================================================================
*** pt.c	(revision 115018)
--- pt.c	(working copy)
*************** convert_template_argument (tree parm,
*** 3837,3847 ****
  			   tree in_decl)
  {
    tree val;
-   tree inner_args;
    int is_type, requires_type, is_tmpl_type, requires_tmpl_type;
  
-   inner_args = INNERMOST_TEMPLATE_ARGS (args);
- 
    if (TREE_CODE (arg) == TREE_LIST
        && TREE_CODE (TREE_VALUE (arg)) == OFFSET_REF)
      {
--- 3831,3838 ----
*************** convert_template_argument (tree parm,
*** 3933,3939 ****
  
  	      if (coerce_template_template_parms (parmparm, argparm,
  						  complain, in_decl,
! 						  inner_args))
  		{
  		  val = arg;
  
--- 3924,3930 ----
  
  	      if (coerce_template_template_parms (parmparm, argparm,
  						  complain, in_decl,
! 						  args))
  		{
  		  val = arg;
  
Index: testsuite/g++.dg/template/ttp20.C
===================================================================
*** testsuite/g++.dg/template/ttp20.C	(revision 0)
--- testsuite/g++.dg/template/ttp20.C	(revision 0)
***************
*** 0 ****
--- 1,11 ----
+ // PR c++/27424
+ // Bug: failing to substitute the 'int' into C
+ 
+ template<typename T> struct A
+ {
+     template<template<T> class> struct B {};
+     template<T> struct C;
+     B<C> b;
+ };
+ 
+ A<int> a;

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