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: Fix PR 9778


The 16Jan2003 merger of build_expr_from_tree() and tsubst_copy() (http://gcc.gnu.org/ml/gcc-patches/2003-01/msg01174.html) omitted one piece. Thanks to Wolfgang Bangerth for raising this issue.

2003-Feb-24 Jeffrey D. Oldham <oldham at codesourcery dot com>

    PR c++/9778
    * cp/pt.c (tsubst_copy_and_build): For a templated function inside a
    scope, process template arguments.
    * testsuite/g++.dg/parse/template6.C: New test case.

Tested on: i686-pc-linux-gnu by running g++ and libstdc++-v3 testsuites with no new regressions.
Applied to: head
Approved by: Mark Mitchell.


Thanks,
Jeffrey D. Oldham
oldham at codesourcery dot com
? 9778.24Feb.11.5.ChangeLog
? 9778.24Feb.11.5.patch
Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.663
diff -c -p -r1.663 pt.c
*** cp/pt.c	24 Feb 2003 07:43:22 -0000	1.663
--- cp/pt.c	24 Feb 2003 19:35:19 -0000
*************** tsubst_copy_and_build (t, args, complain
*** 8137,8143 ****
  	    if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
  	      name = build_nt (TEMPLATE_ID_EXPR,
  			       TREE_OPERAND (name, 0),
! 			       TREE_OPERAND (name, 1));
  	    
  	    function = resolve_scoped_fn_name (TREE_OPERAND (function, 0),
  					       name);
--- 8137,8143 ----
  	    if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
  	      name = build_nt (TEMPLATE_ID_EXPR,
  			       TREE_OPERAND (name, 0),
! 			       build_expr_from_tree (TREE_OPERAND (name, 1)));
  	    
  	    function = resolve_scoped_fn_name (TREE_OPERAND (function, 0),
  					       name);
Index: testsuite/g++.dg/parse/template6.C
===================================================================
RCS file: testsuite/g++.dg/parse/template6.C
diff -N testsuite/g++.dg/parse/template6.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/parse/template6.C	24 Feb 2003 19:35:21 -0000
***************
*** 0 ****
--- 1,20 ----
+ // { dg-do compile }
+ 
+ // Copyright (C) 2003 Free Software Foundation, Inc.
+ // Contributed by Wolfgang Bangerth <bangerth at ticam dot utexas dot edu> 20 Feb 2003.
+ 
+ // PR c++/9778.  Ensure templated functions in other namespaces are
+ // correctly instantiated.
+ 
+ namespace NS {
+   template <int N> void foo ();
+ }
+ 
+ template <int N> struct X {
+   int m;
+   void g () {
+     NS::foo<sizeof(m)>();
+   }
+ };
+ 
+ template class X<2>;

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