OSDN Git Service

PR c++/13925
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Feb 2004 20:01:59 +0000 (20:01 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Feb 2004 20:01:59 +0000 (20:01 +0000)
* decl.c (start_function): Do not call pushdecl for any
instantiation or specialization of a primary template.

PR c++/13925
* g++.dg/template/lookup5.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@77187 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 7a398cb..47fbb96 100644 (file)
@@ -1,5 +1,11 @@
 2004-02-03  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/13925
+       * decl.c (start_function): Do not call pushdecl for any
+       instantiation or specialization of a primary template.
+
+2004-02-03  Mark Mitchell  <mark@codesourcery.com>
+
        PR c++/13950
        * parser.c (cp_parser_class_name): Robustify.
 
index c949c74..a70a2fa 100644 (file)
@@ -10272,8 +10272,9 @@ start_function (tree declspecs, tree declarator, tree attrs, int flags)
   if (!processing_template_decl && !(flags & SF_PRE_PARSED))
     {
       /* A specialization is not used to guide overload resolution.  */
-      if (!DECL_TEMPLATE_SPECIALIZATION (decl1)
-         && ! DECL_FUNCTION_MEMBER_P (decl1))
+      if (!DECL_FUNCTION_MEMBER_P (decl1)
+         && !(DECL_USE_TEMPLATE (decl1) && 
+              PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (decl1))))
        {
          tree olddecl = pushdecl (decl1);
 
index 00c0b71..f31c5c5 100644 (file)
@@ -1,5 +1,10 @@
 2004-02-03  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/13925
+       * g++.dg/template/lookup5.C: New test.
+
+2004-02-03  Mark Mitchell  <mark@codesourcery.com>
+
        PR c++/13950
        * g++.dg/template/lookup4.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/template/lookup5.C b/gcc/testsuite/g++.dg/template/lookup5.C
new file mode 100644 (file)
index 0000000..022202a
--- /dev/null
@@ -0,0 +1,17 @@
+// PR c++/13925
+
+namespace N {
+  template <class T> void f(T);
+
+  namespace M {
+    class A {
+      friend void f<int>(int);
+    };
+  }
+
+  template <class T> void f(T) {}
+  template <> void f<int>(int )
+  { 
+    f<long>(0);
+  }
+}