re PR c++/13925 (Bug while befriending specializations)

PR c++/13925
	* decl.c (start_function): Do not call pushdecl for any
	instantiation or specialization of a primary template.

	PR c++/13925
	* g++.dg/template/lookup5.C: New test.

From-SVN: r77187
This commit is contained in:
Mark Mitchell 2004-02-03 20:01:59 +00:00 committed by Mark Mitchell
parent 4bfb8bbaf6
commit 18f5be99b4
4 changed files with 31 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2004-02-03 Mark Mitchell <mark@codesourcery.com>
PR c++/13925
* decl.c (start_function): Do not call pushdecl for any
instantiation or specialization of a primary template.
2004-02-03 Mark Mitchell <mark@codesourcery.com>
PR c++/13950

View file

@ -10272,8 +10272,9 @@ start_function (tree declspecs, tree declarator, tree attrs, int flags)
if (!processing_template_decl && !(flags & SF_PRE_PARSED))
{
/* A specialization is not used to guide overload resolution. */
if (!DECL_TEMPLATE_SPECIALIZATION (decl1)
&& ! DECL_FUNCTION_MEMBER_P (decl1))
if (!DECL_FUNCTION_MEMBER_P (decl1)
&& !(DECL_USE_TEMPLATE (decl1) &&
PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (decl1))))
{
tree olddecl = pushdecl (decl1);

View file

@ -1,3 +1,8 @@
2004-02-03 Mark Mitchell <mark@codesourcery.com>
PR c++/13925
* g++.dg/template/lookup5.C: New test.
2004-02-03 Mark Mitchell <mark@codesourcery.com>
PR c++/13950

View file

@ -0,0 +1,17 @@
// PR c++/13925
namespace N {
template <class T> void f(T);
namespace M {
class A {
friend void f<int>(int);
};
}
template <class T> void f(T) {}
template <> void f<int>(int )
{
f<long>(0);
}
}