cp-tree.h (DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION): New macro.
* cp-tree.h (DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION): New macro. * decl2.c (import_export_decl): Likewise. * pt.c (instantiate_decl): Use it. From-SVN: r22160
This commit is contained in:
parent
2c2b32dc36
commit
61289ca3b2
|
@ -1,3 +1,9 @@
|
||||||
|
1998-09-01 Mark Mitchell <mark@markmitchell.com>
|
||||||
|
|
||||||
|
* cp-tree.h (DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION): New macro.
|
||||||
|
* decl2.c (import_export_decl): Likewise.
|
||||||
|
* pt.c (instantiate_decl): Use it.
|
||||||
|
|
||||||
1998-09-01 Jason Merrill <jason@yorick.cygnus.com>
|
1998-09-01 Jason Merrill <jason@yorick.cygnus.com>
|
||||||
|
|
||||||
* decl.c (lookup_name_real): Also do implicit typename thing for
|
* decl.c (lookup_name_real): Also do implicit typename thing for
|
||||||
|
|
|
@ -1724,6 +1724,16 @@ extern int flag_new_for_scope;
|
||||||
#define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
|
#define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
|
||||||
(CLASSTYPE_USE_TEMPLATE(NODE) = 3)
|
(CLASSTYPE_USE_TEMPLATE(NODE) = 3)
|
||||||
|
|
||||||
|
/* Non-zero if DECL is a friend function which is an instantiation
|
||||||
|
from the point of view of the compiler, but not from the point of
|
||||||
|
view of the language. For example given:
|
||||||
|
template <class T> struct S { friend void f(T) {}; };
|
||||||
|
the declaration of `void f(int)' generated when S<int> is
|
||||||
|
instantiated will not be a DECL_TEMPLATE_INSTANTIATION, but will be
|
||||||
|
a DECL_FRIEND_PSUEDO_TEMPLATE_INSTANTIATION. */
|
||||||
|
#define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \
|
||||||
|
(DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL))
|
||||||
|
|
||||||
/* Non-zero iff we are currently processing a declaration for an
|
/* Non-zero iff we are currently processing a declaration for an
|
||||||
entity with its own template parameter list, and which is not a
|
entity with its own template parameter list, and which is not a
|
||||||
full specialization. */
|
full specialization. */
|
||||||
|
|
|
@ -2837,10 +2837,12 @@ import_export_decl (decl)
|
||||||
if (DECL_INTERFACE_KNOWN (decl))
|
if (DECL_INTERFACE_KNOWN (decl))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (DECL_TEMPLATE_INSTANTIATION (decl))
|
if (DECL_TEMPLATE_INSTANTIATION (decl)
|
||||||
|
|| DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (decl))
|
||||||
{
|
{
|
||||||
DECL_NOT_REALLY_EXTERN (decl) = 1;
|
DECL_NOT_REALLY_EXTERN (decl) = 1;
|
||||||
if (DECL_IMPLICIT_INSTANTIATION (decl)
|
if ((DECL_IMPLICIT_INSTANTIATION (decl)
|
||||||
|
|| DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (decl))
|
||||||
&& (flag_implicit_templates || DECL_THIS_INLINE (decl)))
|
&& (flag_implicit_templates || DECL_THIS_INLINE (decl)))
|
||||||
{
|
{
|
||||||
if (!TREE_PUBLIC (decl))
|
if (!TREE_PUBLIC (decl))
|
||||||
|
|
|
@ -7939,8 +7939,7 @@ instantiate_decl (d)
|
||||||
we don't need to look any further. That's what the check for
|
we don't need to look any further. That's what the check for
|
||||||
DECL_INITIAL is for. */
|
DECL_INITIAL is for. */
|
||||||
|| (TREE_CODE (d) == FUNCTION_DECL
|
|| (TREE_CODE (d) == FUNCTION_DECL
|
||||||
&& DECL_TEMPLATE_INFO (td)
|
&& DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (td)
|
||||||
&& !DECL_TEMPLATE_SPECIALIZATION (td)
|
|
||||||
&& !DECL_INITIAL (DECL_TEMPLATE_RESULT (td)));
|
&& !DECL_INITIAL (DECL_TEMPLATE_RESULT (td)));
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
// Build don't run:
|
||||||
|
// Special g++ Options: -g
|
||||||
|
|
||||||
|
template <class P1>
|
||||||
|
struct S1
|
||||||
|
{
|
||||||
|
struct SS1
|
||||||
|
{
|
||||||
|
};
|
||||||
|
friend void Foo (const SS1& ss1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class P1>
|
||||||
|
void Foo(const S1<P1>& s1)
|
||||||
|
{
|
||||||
|
typedef typename S1<P1>::SS1 TYPE;
|
||||||
|
TYPE t;
|
||||||
|
Foo(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main ()
|
||||||
|
{
|
||||||
|
S1<double> obj;
|
||||||
|
Foo(obj);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue