re PR c++/18962 (specialization of template class with inner template members and...
authorAlexandre Oliva <aoliva@redhat.com>
Thu, 23 Dec 2004 16:12:57 +0000 (16:12 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Thu, 23 Dec 2004 16:12:57 +0000 (16:12 +0000)
gcc/cp/ChangeLog:
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.

From-SVN: r92552

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

index 2d6e1af0133550b41b38881d19da73d37fc30c0e..c8e448f4e2b800c5d95fc9034e831cebd910f002 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 07cdd5d7356021cbcdd7ef7eee367304f132b118..3c6f5bcbbdf291b5dd838c22f9aab4885ee2ba16 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 45620fdd5617b1a6a5619b5f80f48a3ee5fa32cd..3a91de1d3657a994e9af978643d0e7199ac1e6f1 100644 (file)
@@ -1,3 +1,7 @@
+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
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 );
+}