From 3cb9d1d59a14630ef7c7bb6216c719066172ac86 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Mon, 16 Nov 2009 14:58:33 +0000 Subject: re PR c++/42055 (ICE with ambiguous template specialization) cp/ 2009-11-16 Paolo Carlini PR c++/42055 * pt.c (determine_specialization): Assign to candidates the return value of the chainon called before print_candidates. testsuite/ 2009-11-16 Paolo Carlini PR c++/42055 * testsuite/g++.dg/template/crash92.C: New. From-SVN: r154202 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/template/crash92.C | 7 +++++++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/template/crash92.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2b18d01..ce4415d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 2009-11-16 Paolo Carlini + PR c++/42055 + * pt.c (determine_specialization): Assign to candidates the return + value of the chainon called before print_candidates. + +2009-11-16 Paolo Carlini + PR c++/32056 * decl.h (enum decl_context): Add TPARM enumerator. * decl.c (grokdeclarator): Per 14.1/2, error out if a storage class diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index b7d72c1..4ca94d6 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1941,7 +1941,7 @@ determine_specialization (tree template_id, { error ("ambiguous template specialization %qD for %q+D", template_id, decl); - chainon (candidates, templates); + candidates = chainon (candidates, templates); print_candidates (candidates); return error_mark_node; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 753a8b2..42702eb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2009-11-16 Paolo Carlini + PR c++/42055 + * testsuite/g++.dg/template/crash92.C: New. + +2009-11-16 Paolo Carlini + PR c++/32056 * testsuite/g++.dg/template/error44.C: New. diff --git a/gcc/testsuite/g++.dg/template/crash92.C b/gcc/testsuite/g++.dg/template/crash92.C new file mode 100644 index 0000000..c0219c4 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash92.C @@ -0,0 +1,7 @@ +// PR c++/42055 + +template void foo(T, T); // { dg-error "candidates|template" } + +template void foo(T, int); // { dg-error "template" } + +template void foo(int, int); // { dg-error "ambiguous template specialization" } -- cgit v1.1