This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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;
     }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]