This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ Patch] PR 42055
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Cc: Jason Merrill <jason at redhat dot com>
- Date: Mon, 16 Nov 2009 12:21:42 +0100
- Subject: [C++ Patch] PR 42055
Hi,
a very simple patch for a simple [4.5 Regression], tested x86_64-linux.
Ok?
Paolo.
///////////////////
cp/
2009-11-16 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/42055
* pt.c (determine_specialization): Don't call print_candidates with
a null argument.
testsuite/
2009-11-16 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/42055
* testsuite/g++.dg/template/crash92.C: New.
Index: testsuite/g++.dg/template/crash92.C
===================================================================
--- testsuite/g++.dg/template/crash92.C (revision 0)
+++ testsuite/g++.dg/template/crash92.C (revision 0)
@@ -0,0 +1,7 @@
+// PR c++/42055
+
+template<typename T> void foo(T, T);
+
+template<typename T> void foo(T, int);
+
+template void foo(int, int); // { dg-error "ambiguous template specialization" }
Index: cp/pt.c
===================================================================
--- cp/pt.c (revision 154197)
+++ cp/pt.c (working copy)
@@ -1942,7 +1942,8 @@ determine_specialization (tree template_id,
error ("ambiguous template specialization %qD for %q+D",
template_id, decl);
chainon (candidates, templates);
- print_candidates (candidates);
+ if (candidates)
+ print_candidates (candidates);
return error_mark_node;
}