re PR c++/6949 (ICE in tsubst_decl, at cp/pt.c:5733)
authorMark Mitchell <mark@codesourcery.com>
Wed, 2 Jul 2003 04:11:30 +0000 (04:11 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 2 Jul 2003 04:11:30 +0000 (04:11 +0000)
PR c++/6949
* decl2.c (grokfield): Create TEMPLATE_DECLs for methods in local
classes.

PR c++/6949
* g++.dg/template/local3.C: New test.

From-SVN: r68818

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/local3.C [new file with mode: 0644]

index a76a82b1017104d8a556a3b87cdc6d30436a285e..c0480b97c5660d3c0298e9688445b33d8e8928ef 100644 (file)
@@ -1,3 +1,9 @@
+2003-07-01  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/6949
+       * decl2.c (grokfield): Create TEMPLATE_DECLs for methods in local
+       classes.
+
 2003-07-01  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * error.c (locate_error): %P takes an `int', not a `tree'.
index a440c064478ebfc9ebe28dd59c5d5762daae0692..c6217936918c2b8b1a53d5dcc7601a591e46432a 100644 (file)
@@ -970,7 +970,7 @@ grokfield (tree declarator, tree declspecs, tree init, tree asmspec_tree,
        }
     }
 
-  if (processing_template_decl && ! current_function_decl
+  if (processing_template_decl
       && (TREE_CODE (value) == VAR_DECL || TREE_CODE (value) == FUNCTION_DECL))
     value = push_template_decl (value);
 
index 86cabcb6cfa7ed21efb9c7475c27e1ec6e96c751..3d9914d8dfb375234525284548ed709b6a0d280e 100644 (file)
@@ -1,5 +1,8 @@
 2003-07-01  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/6949
+       * g++.dg/template/local3.C: New test.
+
        PR c++/11149
        * g++.dg/lookup/scoped6.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/template/local3.C b/gcc/testsuite/g++.dg/template/local3.C
new file mode 100644 (file)
index 0000000..4d6a576
--- /dev/null
@@ -0,0 +1,14 @@
+ template<class T>
+ void f(const T&)
+ {
+         struct B {
+          
+                 void g (T);
+         };
+         B b;
+ };
+ void g()
+ {
+         f(42);
+ }