re PR c++/35282 (Template specialization rejected)
authorPaolo Carlini <pcarlini@suse.de>
Fri, 22 Feb 2008 11:02:00 +0000 (11:02 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 22 Feb 2008 11:02:00 +0000 (11:02 +0000)
/testsuite
2008-02-22  Paolo Carlini  <pcarlini@suse.de>

PR c++/35282
* g++.dg/template/nontype17.C: Add.

/cp
2008-02-22  Paolo Carlini  <pcarlini@suse.de>

PR c++/35282
Revert:
2008-02-14  Paolo Carlini  <pcarlini@suse.de>

        PR c++/28743
        * pt.c (determine_specialization): In case of function templates,
when the type of DECL does not match FN there is no match.

/testsuite
2008-02-22  Paolo Carlini  <pcarlini@suse.de>

PR c++/35282
Revert:
2008-02-14  Paolo Carlini  <pcarlini@suse.de>

        PR c++/28743
* g++.dg/template/nontype17.C: New.
        * g++.dg/template/nontype16.C: Add error.

From-SVN: r132543

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/nontype16.C
gcc/testsuite/g++.dg/template/nontype17.C

index b300db04bff071c0b65aa0b3591d854095ecb244..19c34ba5cfa81f9249ab7548cb261a42d3ed3314 100644 (file)
@@ -1,3 +1,13 @@
+2008-02-22  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/35282
+       Revert:
+       2008-02-14  Paolo Carlini  <pcarlini@suse.de>
+
+        PR c++/28743
+        * pt.c (determine_specialization): In case of function templates,
+       when the type of DECL does not match FN there is no match.
+
 2008-02-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        PR c/19999
index e45f6da91e7fb1170dbdee9fecde428602e8189f..2a54986c551df6579efe4b68a12153ad2f54ad02 100644 (file)
@@ -1563,9 +1563,12 @@ determine_specialization (tree template_id,
             no partial specializations of functions.  Therefore, if
             the type of DECL does not match FN, there is no
             match.  */
-         if (tsk == tsk_template
-             && !compparms (fn_arg_types, decl_arg_types))
-           continue;
+         if (tsk == tsk_template)
+           {
+             if (compparms (fn_arg_types, decl_arg_types))
+               candidates = tree_cons (NULL_TREE, fn, candidates);
+             continue;
+           }
 
          /* See whether this function might be a specialization of this
             template.  */
index 493effcce42b6870a89c63d85a258f11bf091485..053949b98c24f31893e52809a2caf9dbc04c367a 100644 (file)
@@ -1,3 +1,18 @@
+2008-02-22  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/35282
+       * g++.dg/template/nontype17.C: Add.
+
+2008-02-22  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/35282
+       Revert:
+       2008-02-14  Paolo Carlini  <pcarlini@suse.de>
+
+        PR c++/28743
+       * g++.dg/template/nontype17.C: New.
+        * g++.dg/template/nontype16.C: Add error.
+
 2008-02-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        PR c/19999
index 4b9f7602876c4ec36b3fb310bfb936417bbebcb2..36d1e9564a0948a33bbf485132cfe3baa199af74 100644 (file)
@@ -5,5 +5,5 @@ template<int> struct A
     template<typename> void foo();
 };
 
-template<> template<struct T> void A<0>::foo() {} // { dg-error "not a valid type|match" }
+template<> template<struct T> void A<0>::foo() {} // { dg-error "not a valid type" }
  
index c8f3404dea7759e03abd9efaa05bc1b40355d972..f3a4480c9e337bc44ebe03576dc6e32e368346bb 100644 (file)
@@ -1,8 +1,8 @@
-// PR c++/28743
+// PR c++/35282
 
 template<int> struct A
 {
-    template<typename> void foo();
+    template<int> void foo();
 };
 
-template<int> template<typename> void A<0>::foo() {} // { dg-error "match" }
+template<> template<int> void A<0>::foo() {}