aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2008-02-14 12:34:42 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2008-02-14 12:34:42 +0000
commit4571259b7a5875586d1579334aa9b944b103216b (patch)
tree2f1072d8d319f8bddd80a01dbf037db9911b292a /gcc
parentb49326f1ca9f1e9ec206d431643cf1996008fdcf (diff)
downloadgcc-4571259b7a5875586d1579334aa9b944b103216b.zip
gcc-4571259b7a5875586d1579334aa9b944b103216b.tar.gz
gcc-4571259b7a5875586d1579334aa9b944b103216b.tar.bz2
re PR c++/28743 (ICE with invalid specialization)
/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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c9
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/template/nontype16.C2
-rw-r--r--gcc/testsuite/g++.dg/template/nontype17.C8
5 files changed, 24 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c237abd..275ca4b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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>
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 577b621..2e2a636 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0eac359..7a4d5bb 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
diff --git a/gcc/testsuite/g++.dg/template/nontype16.C b/gcc/testsuite/g++.dg/template/nontype16.C
index 36d1e95..4b9f760 100644
--- a/gcc/testsuite/g++.dg/template/nontype16.C
+++ b/gcc/testsuite/g++.dg/template/nontype16.C
@@ -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
index 0000000..c8f3404
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/nontype17.C
@@ -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" }