re PR c++/35986 (ICE with ambiguous template functions)

PR c++/35986
	* pt.c (more_specialized_fn): Stop the loop even if there are no
	arguments before ellipsis.

	* g++.dg/overload/template4.C: New test.

From-SVN: r134823
This commit is contained in:
Jakub Jelinek 2008-04-30 16:24:18 +02:00 committed by Jakub Jelinek
parent 5856b807fd
commit 56b1a55446
4 changed files with 35 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2008-04-30 Jakub Jelinek <jakub@redhat.com>
PR c++/35986
* pt.c (more_specialized_fn): Stop the loop even if there are no
arguments before ellipsis.
2008-04-29 Jakub Jelinek <jakub@redhat.com>
PR c++/35650

View file

@ -13652,7 +13652,9 @@ more_specialized_fn (tree pat1, tree pat2, int len)
processing_template_decl++;
while (len--)
while (len--
/* Stop when an ellipsis is seen. */
&& args1 != NULL_TREE && args2 != NULL_TREE)
{
tree arg1 = TREE_VALUE (args1);
tree arg2 = TREE_VALUE (args2);
@ -13815,10 +13817,6 @@ more_specialized_fn (tree pat1, tree pat2, int len)
args1 = TREE_CHAIN (args1);
args2 = TREE_CHAIN (args2);
/* Stop when an ellipsis is seen. */
if (args1 == NULL_TREE || args2 == NULL_TREE)
break;
}
processing_template_decl--;

View file

@ -1,3 +1,8 @@
2008-04-30 Jakub Jelinek <jakub@redhat.com>
PR c++/35986
* g++.dg/overload/template4.C: New test.
2008-04-30 Kai Tietz <kai.tietz@onevision.com>
* gfortran.dg/chmod_1.f90: Disable for x86_64-*-mingw*.

View file

@ -0,0 +1,21 @@
// PR c++/35986
// { dg-do compile }
namespace
{
template <int> void foo (...); // { dg-error "" "candidate" }
template <int> void bar (int, ...); // { dg-error "" "candidate" }
void baz (...); // { dg-error "" "candidate" }
}
template <int> void foo (...); // { dg-error "" "candidate" }
template <int> void bar (int, ...); // { dg-error "" "candidate" }
void baz (...); // { dg-error "" "candidate" }
void
test ()
{
foo <0> (0); // { dg-error "is ambiguous" }
bar <1> (0, 1); // { dg-error "is ambiguous" }
baz (0); // { dg-error "is ambiguous" }
}