From cc85b4c564805534a69a0c23999c3e2c32d904b8 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 19 Feb 2008 17:53:07 -0500 Subject: [PATCH] re PR c++/34950 (ICE in svn boost math toolkit) PR c++/34950 * pt.c (resolve_overloaded_unification): Set processing_template_decl while we look for possible bindings. From-SVN: r132455 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 2 ++ .../g++.dg/template/explicit-args1.C | 21 +++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/explicit-args1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6f016fcfce5..81a243a1354 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-02-19 Jason Merrill + + PR c++/34950 + * pt.c (resolve_overloaded_unification): Set processing_template_decl + while we look for possible bindings. + 2008-02-19 Jakub Jelinek PR c++/35028 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 5931126e860..e45f6da91e7 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -12137,6 +12137,7 @@ resolve_overloaded_unification (tree tparms, if (TREE_CODE (fn) != TEMPLATE_DECL) continue; + ++processing_template_decl; subargs = get_bindings (fn, DECL_TEMPLATE_RESULT (fn), expl_subargs, /*check_ret=*/false); if (subargs) @@ -12145,6 +12146,7 @@ resolve_overloaded_unification (tree tparms, good += try_one_overload (tparms, targs, tempargs, parm, elem, strict, sub_strict, addr_p); } + --processing_template_decl; } } else if (TREE_CODE (arg) != OVERLOAD diff --git a/gcc/testsuite/g++.dg/template/explicit-args1.C b/gcc/testsuite/g++.dg/template/explicit-args1.C new file mode 100644 index 00000000000..10d59e15734 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/explicit-args1.C @@ -0,0 +1,21 @@ +// PR c++/34950 + +template struct policy { + typedef int unnecessary; +}; + +template struct A { + typedef int type; + typedef typename Policy::unnecessary unused; +}; + +template struct S { + typedef int type; + typedef typename A::type unused; +}; + +template typename S::type foo(); +template S >::type foo(); + +template int def(T); +const int i = def(foo); -- 2.30.2