]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/28743 (ICE with invalid specialization)
authorPaolo Carlini <pcarlini@suse.de>
Thu, 14 Feb 2008 12:34:42 +0000 (12:34 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 14 Feb 2008 12:34:42 +0000 (12:34 +0000)
/cp
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-14  Paolo Carlini  <pcarlini@suse.de>

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

From-SVN: r132316

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

index c237abda40dedce529c722890764ec7b9c9581e6..275ca4b1aebf2584ee2ee9ec080b7e31e8d41bda 100644 (file)
@@ -1,3 +1,9 @@
+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-13  Jakub Jelinek  <jakub@redhat.com>
            Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
 
index 577b62165808257817ff8776a7213317790226c3..2e2a636d239b977207b889354b62a094a7a0f47d 100644 (file)
@@ -1561,12 +1561,9 @@ 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)
-           {
-             if (compparms (fn_arg_types, decl_arg_types))
-               candidates = tree_cons (NULL_TREE, fn, candidates);
-             continue;
-           }
+         if (tsk == tsk_template
+             && !compparms (fn_arg_types, decl_arg_types))
+           continue;
 
          /* See whether this function might be a specialization of this
             template.  */
index 0eac359748fa81787820c0fa5aad78a06b250523..7a4d5bb4d8712640494ba55043f62438ec9e37ae 100644 (file)
@@ -1,3 +1,9 @@
+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-13  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/35138
index 36d1e9564a0948a33bbf485132cfe3baa199af74..4b9f7602876c4ec36b3fb310bfb936417bbebcb2 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" }
+template<> template<struct T> void A<0>::foo() {} // { dg-error "not a valid type|match" }
  
diff --git a/gcc/testsuite/g++.dg/template/nontype17.C b/gcc/testsuite/g++.dg/template/nontype17.C
new file mode 100644 (file)
index 0000000..c8f3404
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/28743
+
+template<int> struct A
+{
+    template<typename> void foo();
+};
+
+template<int> template<typename> void A<0>::foo() {} // { dg-error "match" }