* 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
+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>
* decl.c (lookup_name_real): Also do implicit typename thing for
#define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
(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
entity with its own template parameter list, and which is not a
full specialization. */
if (DECL_INTERFACE_KNOWN (decl))
return;
- if (DECL_TEMPLATE_INSTANTIATION (decl))
+ if (DECL_TEMPLATE_INSTANTIATION (decl)
+ || DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (decl))
{
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)))
{
if (!TREE_PUBLIC (decl))
we don't need to look any further. That's what the check for
DECL_INITIAL is for. */
|| (TREE_CODE (d) == FUNCTION_DECL
- && DECL_TEMPLATE_INFO (td)
- && !DECL_TEMPLATE_SPECIALIZATION (td)
+ && DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (td)
&& !DECL_INITIAL (DECL_TEMPLATE_RESULT (td)));
)
{
--- /dev/null
+// 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);
+}
+