* pt.c (tsubst_friend_class): Check for NULL.

From-SVN: r26688
This commit is contained in:
Mark Mitchell 1999-04-28 13:14:20 +00:00
parent 94ff101fbd
commit bc639f9058
2 changed files with 11 additions and 1 deletions

View File

@ -4641,7 +4641,7 @@ tsubst_friend_class (friend_tmpl, args)
Here, in the scope of (say) S<int>, `S' is bound to a TYPE_DECL
for `S<int>', not the TEMPLATE_DECL. */
if (!DECL_CLASS_TEMPLATE_P (tmpl))
if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl))
{
tmpl = lookup_name (DECL_NAME (friend_tmpl), /*prefer_type=*/1);
tmpl = maybe_get_template_decl_from_type_decl (tmpl);

View File

@ -0,0 +1,10 @@
// Build don't link:
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
struct S {
template <class U>
friend struct S2;
};
template struct S<int>;