From 54062fc0da3a1009eb0f53e899fb44d8b7b4a177 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 22 Feb 2008 11:02:00 +0000 Subject: re PR c++/35282 (Template specialization rejected) /testsuite 2008-02-22 Paolo Carlini PR c++/35282 * g++.dg/template/nontype17.C: Add. /cp 2008-02-22 Paolo Carlini PR c++/35282 Revert: 2008-02-14 Paolo Carlini 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 PR c++/35282 Revert: 2008-02-14 Paolo Carlini PR c++/28743 * g++.dg/template/nontype17.C: New. * g++.dg/template/nontype16.C: Add error. From-SVN: r132543 --- gcc/cp/ChangeLog | 10 ++++++++++ gcc/cp/pt.c | 9 ++++++--- gcc/testsuite/ChangeLog | 15 +++++++++++++++ gcc/testsuite/g++.dg/template/nontype16.C | 2 +- gcc/testsuite/g++.dg/template/nontype17.C | 6 +++--- 5 files changed, 35 insertions(+), 7 deletions(-) (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b300db0..19c34ba 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2008-02-22 Paolo Carlini + + PR c++/35282 + Revert: + 2008-02-14 Paolo Carlini + + 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 PR c/19999 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index e45f6da..2a54986 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 493effc..053949b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,18 @@ +2008-02-22 Paolo Carlini + + PR c++/35282 + * g++.dg/template/nontype17.C: Add. + +2008-02-22 Paolo Carlini + + PR c++/35282 + Revert: + 2008-02-14 Paolo Carlini + + PR c++/28743 + * g++.dg/template/nontype17.C: New. + * g++.dg/template/nontype16.C: Add error. + 2008-02-22 Ralf Wildenhues PR c/19999 diff --git a/gcc/testsuite/g++.dg/template/nontype16.C b/gcc/testsuite/g++.dg/template/nontype16.C index 4b9f7602..36d1e95 100644 --- a/gcc/testsuite/g++.dg/template/nontype16.C +++ b/gcc/testsuite/g++.dg/template/nontype16.C @@ -5,5 +5,5 @@ template struct A template void foo(); }; -template<> template void A<0>::foo() {} // { dg-error "not a valid type|match" } +template<> template void A<0>::foo() {} // { dg-error "not a valid type" } diff --git a/gcc/testsuite/g++.dg/template/nontype17.C b/gcc/testsuite/g++.dg/template/nontype17.C index c8f3404..f3a4480 100644 --- a/gcc/testsuite/g++.dg/template/nontype17.C +++ b/gcc/testsuite/g++.dg/template/nontype17.C @@ -1,8 +1,8 @@ -// PR c++/28743 +// PR c++/35282 template struct A { - template void foo(); + template void foo(); }; -template template void A<0>::foo() {} // { dg-error "match" } +template<> template void A<0>::foo() {} -- cgit v1.1