From: Mark Mitchell Date: Thu, 21 Aug 2003 05:50:53 +0000 (+0000) Subject: re PR c++/11834 (template specialization not matched) X-Git-Tag: releases/gcc-3.4.0~4150 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35c18a2035bc75f7b5dc68f5385986426b5308eb;p=thirdparty%2Fgcc.git re PR c++/11834 (template specialization not matched) PR c++/11834 * pt.c (more_specialized): Bump processing_template_decl. PR c++/11834 * g++.dg/template/deduce2.C: New test. From-SVN: r70639 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fc6ae49f5aca..8ef1aeb0d1f1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2003-08-20 Mark Mitchell + + PR c++/11834 + * pt.c (more_specialized): Bump processing_template_decl. + 2003-08-21 Jason Merrill PR c++/11614 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 20642c385425..c66b5bc504b0 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9880,6 +9880,10 @@ more_specialized (tree pat1, tree pat2, int deduce, int len) tree targs; int winner = 0; + /* If template argument deduction succeeds, we substitute the + resulting arguments into non-deduced contexts. While doing that, + we must be aware that we may encounter dependent types. */ + ++processing_template_decl; targs = get_bindings_real (pat1, DECL_TEMPLATE_RESULT (pat2), NULL_TREE, 0, deduce, len); if (targs) @@ -9889,6 +9893,7 @@ more_specialized (tree pat1, tree pat2, int deduce, int len) NULL_TREE, 0, deduce, len); if (targs) ++winner; + --processing_template_decl; return winner; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7e1135243f44..567065258e58 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-08-20 Mark Mitchell + + PR c++/11834 + * g++.dg/template/deduce2.C: New test. + 2003-08-21 Josef Zlomek * gcc.c-torture/execute/20030821-1.c: New test. diff --git a/gcc/testsuite/g++.dg/template/deduce2.C b/gcc/testsuite/g++.dg/template/deduce2.C new file mode 100644 index 000000000000..bcf77b30b78b --- /dev/null +++ b/gcc/testsuite/g++.dg/template/deduce2.C @@ -0,0 +1,30 @@ +template struct tuple { + typedef tuple tail; +}; + +template <> struct tuple { +}; + +template +struct length { + static const int i = length::tail>::i; +}; + +template<> +struct length > { + static const int i = 1; +}; + +template struct M {}; + +template +M >::i > foo (A*); + +template +M >::i> foo (const A*); + +const int i1 = 3; + +void bar() { + foo (&i1); +}