diff options
author | lerdsuwa <lerdsuwa@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-19 15:03:58 +0000 |
---|---|---|
committer | lerdsuwa <lerdsuwa@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-19 15:03:58 +0000 |
commit | 7c0f064134ed3797a8124108cafc5a2c8d8179d0 (patch) | |
tree | 5f12475ae2f27a76ecdf20b0bcd423cc0fab60c9 /gcc | |
parent | 1e9af8800dc972d7945c2f273be192532136fa30 (diff) | |
download | gcc-7c0f064134ed3797a8124108cafc5a2c8d8179d0.tar.gz |
PR c++/12170
* pt.c (unify) <BOUND_TEMPLATE_TEMPLATE_PARM case>: Use only
innermost set of template arguments during deduction. Simplify.
* g++.dg/template/ttp9.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84921 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/ttp9.C | 28 |
4 files changed, 42 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 00ef4b59ef1..f4db5d3f256 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2004-07-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> + + PR c++/12170 + * pt.c (unify) <BOUND_TEMPLATE_TEMPLATE_PARM case>: Use only + innermost set of template arguments during deduction. Simplify. + 2004-07-19 Joseph S. Myers <jsm@polyomino.org.uk> * typeck.c (build_modify_expr, build_x_modify_expr): Set diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 59eb9c742d4..b1d9de03cc0 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9650,7 +9650,7 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict) { tree parmtmpl = TYPE_TI_TEMPLATE (parm); tree parmvec = TYPE_TI_ARGS (parm); - tree argvec = TYPE_TI_ARGS (arg); + tree argvec = INNERMOST_TEMPLATE_ARGS (TYPE_TI_ARGS (arg)); tree argtmplvec = DECL_INNERMOST_TEMPLATE_PARMS (TYPE_TI_TEMPLATE (arg)); int i; @@ -9673,9 +9673,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict) for (i = 0; i < TREE_VEC_LENGTH (parmvec); ++i) { - tree t = TREE_VEC_ELT (parmvec, i); - - if (unify (tparms, targs, t, + if (unify (tparms, targs, + TREE_VEC_ELT (parmvec, i), TREE_VEC_ELT (argvec, i), UNIFY_ALLOW_NONE)) return 1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1ca5cb5d13c..51256e5403a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-07-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> + + PR c++/12170 + * g++.dg/template/ttp9.C: New test. + 2004-07-19 Daniel Jacobowitz <dan@debian.org> * gcc.dg/format/cmn-err-1.c: New test. diff --git a/gcc/testsuite/g++.dg/template/ttp9.C b/gcc/testsuite/g++.dg/template/ttp9.C new file mode 100644 index 00000000000..060ab7788ae --- /dev/null +++ b/gcc/testsuite/g++.dg/template/ttp9.C @@ -0,0 +1,28 @@ +// { dg-do compile } + +// Origin: David Abrahams <dave@boost-consulting.com> +// Wolfgang Bangerth <bangerth@ticam.utexas.edu> + +// PR c++/12170: Deducing template template parameter from nested +// class template. + +template <typename> struct W {}; + +template< template<typename> class F, typename T> +int foo(W< F<T> >); + + +template<typename T> +struct L { + static int const value = sizeof(foo(W<T>())); + typedef T type; +}; + + +template <typename> +struct Y { + template <typename> struct X { typedef int type; }; + typedef typename L<X<int> >::type type; +}; + +template struct Y<int>; |