re PR c++/495 (ICE in in lookup_template_class, at cp/pt.c:3961)
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. From-SVN: r71574
This commit is contained in:
parent
472b0fbcf7
commit
68c788471b
@ -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
|
||||
|
@ -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));
|
||||
|
@ -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
|
||||
|
27
gcc/testsuite/g++.dg/template/friend24.C
Normal file
27
gcc/testsuite/g++.dg/template/friend24.C
Normal file
@ -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>)
|
||||
{
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user