Commit c4d0910c by Kriang Lerdsuwanakij Committed by Kriang Lerdsuwanakij

re PR c++/11030 (Cannot befriend a template specialization)

	PR c++/11030
	* pt.c (instantiate_class_template): Don't call xref_tag to
	inject name when the friend class is a specialization.

	* g++.dg/template/friend19.C: New test.

From-SVN: r69088
parent f5d1c3de
2003-07-08 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/11030
* pt.c (instantiate_class_template): Don't call xref_tag to
inject name when the friend class is a specialization.
2003-07-07 Mark Mitchell <mark@codesourcery.com> 2003-07-07 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (build_scoped_method_call): Remove. * cp-tree.h (build_scoped_method_call): Remove.
......
...@@ -5429,6 +5429,8 @@ instantiate_class_template (tree type) ...@@ -5429,6 +5429,8 @@ instantiate_class_template (tree type)
else if (uses_template_parms (friend_type)) else if (uses_template_parms (friend_type))
new_friend_type = tsubst (friend_type, args, new_friend_type = tsubst (friend_type, args,
tf_error | tf_warning, NULL_TREE); tf_error | tf_warning, NULL_TREE);
else if (CLASSTYPE_USE_TEMPLATE (friend_type))
new_friend_type = friend_type;
else else
{ {
tree ns = decl_namespace_context (TYPE_MAIN_DECL (friend_type)); tree ns = decl_namespace_context (TYPE_MAIN_DECL (friend_type));
......
2003-07-08 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/11030
* g++.dg/template/friend19.C: New test.
2003-07-08 Jakub Jelinek <jakub@redhat.com> 2003-07-08 Jakub Jelinek <jakub@redhat.com>
* g++.dg/opt/strength-reduce.C: New test. * g++.dg/opt/strength-reduce.C: New test.
......
// { dg-do compile }
// Origin: Benjamin Li <benxbli@yahoo.com>
// PR c++/11030: Template substition of friend class that is
// a specialization.
template <int S>
struct A
{
void func(void);
};
template <class T>
class C
{
static void private_func(void) {}
public:
friend class A<512>;
};
template <int S>
void A<S>::func(void)
{
C<void>::private_func();
}
template class A<512>;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment