diff options
| author | lerdsuwa <lerdsuwa@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-09-19 14:08:00 +0000 |
|---|---|---|
| committer | lerdsuwa <lerdsuwa@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-09-19 14:08:00 +0000 |
| commit | 566cd7afbdf568145d9e508d86816bd91593a969 (patch) | |
| tree | d12f6f7ece81be97d1ded812e91f6979f2fe7b6e | |
| parent | f547383e26707a3b4b40983d665ed44487402dd4 (diff) | |
| download | ppe42-gcc-566cd7afbdf568145d9e508d86816bd91593a969.tar.gz ppe42-gcc-566cd7afbdf568145d9e508d86816bd91593a969.zip | |
PR c++/495
* pt.c (tsubst_friend_class): Only use innermost template
arguments for the injected friend class template.
* g++.dg/template/friend24.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71574 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
| -rw-r--r-- | gcc/cp/pt.c | 2 | ||||
| -rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/testsuite/g++.dg/template/friend24.C | 27 |
4 files changed, 40 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 15bf1a6f0c7..a18706b38c4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2003-09-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> + + PR c++/495 + * pt.c (tsubst_friend_class): Only use innermost template + arguments for the injected friend class template. + 2003-09-19 Nathan Sidwell <nathan@codesourcery.com> PR c++/12332 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 28ed0bcd232..5e5af5b4c48 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -5001,6 +5001,8 @@ tsubst_friend_class (tree friend_tmpl, tree args) DECL_USE_TEMPLATE (tmpl) = 0; DECL_TEMPLATE_INFO (tmpl) = NULL_TREE; CLASSTYPE_USE_TEMPLATE (TREE_TYPE (tmpl)) = 0; + CLASSTYPE_TI_ARGS (TREE_TYPE (tmpl)) + = INNERMOST_TEMPLATE_ARGS (CLASSTYPE_TI_ARGS (TREE_TYPE (tmpl))); /* Inject this template into the global scope. */ friend_type = TREE_TYPE (pushdecl_top_level (tmpl)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2b1e5663464..77a2c4bd7aa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-09-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> + + PR c++/495 + * g++.dg/template/friend24.C: New test. + 2003-09-19 Nathan Sidwell <nathan@codesourcery.com> PR c++/12332 diff --git a/gcc/testsuite/g++.dg/template/friend24.C b/gcc/testsuite/g++.dg/template/friend24.C new file mode 100644 index 00000000000..5db4d31e721 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/friend24.C @@ -0,0 +1,27 @@ +// { dg-do compile } + +// Origin: Wolfgang Bangerth <bangerth@ticam.utexas.edu> + +// PR c++/495: Fail to locate primary class template that is +// injected by friend declaration. + +template <int N> struct X +{ + template <int dim> friend struct Y; +}; + +X<2> x; + +template <int dim> struct Y +{ + void f (Y); + void g (Y); +}; + +template <int dim> void Y<dim>::f (Y) +{ +} + +template <int dim> void Y<dim>::g (Y<dim>) +{ +} |

