OSDN Git Service

gcc/cp/ChangeLog:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Dec 2004 16:12:57 +0000 (16:12 +0000)
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Dec 2004 16:12:57 +0000 (16:12 +0000)
PR c++/18962
* pt.c (check_explicit_specialization): Use the argument list from
the definition in a template function specialization definition.
gcc/testsuite/ChangeLog:
* g++.dg/template/spec19.C: New.

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

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

index 2d6e1af..c8e448f 100644 (file)
@@ -1,3 +1,9 @@
+2004-12-23  Alexandre Oliva  <aoliva@redhat.com>
+
+       PR c++/18962
+       * pt.c (check_explicit_specialization): Use the argument list from
+       the definition in a template function specialization definition.
+
 2004-12-23  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
 
        PR c++/18733
index 07cdd5d..3c6f5bc 100644 (file)
@@ -2059,6 +2059,10 @@ check_explicit_specialization (tree declarator,
                  DECL_SOURCE_LOCATION (tmpl) = DECL_SOURCE_LOCATION (decl);
                  DECL_SOURCE_LOCATION (DECL_TEMPLATE_RESULT (tmpl))
                    = DECL_SOURCE_LOCATION (decl);
+                 /* We want to use the argument list specified in the
+                    definition, not in the original declaration.  */
+                 DECL_ARGUMENTS (DECL_TEMPLATE_RESULT (tmpl))
+                   = DECL_ARGUMENTS (decl);
                }
              return tmpl;
            }
index 45620fd..3a91de1 100644 (file)
@@ -1,5 +1,9 @@
 2004-12-23  Alexandre Oliva  <aoliva@redhat.com>
 
+       * g++.dg/template/spec19.C: New.
+
+2004-12-23  Alexandre Oliva  <aoliva@redhat.com>
+
        PR target/16891
        * gcc.dg/empty2.c: New.
 
diff --git a/gcc/testsuite/g++.dg/template/spec19.C b/gcc/testsuite/g++.dg/template/spec19.C
new file mode 100644 (file)
index 0000000..c560b01
--- /dev/null
@@ -0,0 +1,23 @@
+// PR c++/18962
+
+template<class T1,int N1>
+class Class
+{
+public:
+  template <class T2,int N2>
+  void function( const Class<T2,N2>& );
+};
+
+template<>
+template<class T2,int N2>
+void Class<int,1>::function( const Class<T2,N2>& param ) 
+{
+  param; // make sure we use the argument list from the definition.
+}
+
+int main()
+{
+  Class<int,1> instance;
+  Class<char,2> param;
+  instance.function( param );
+}