From: Nathan Myers <ncm@cygnus.com>
To: egcs@cygnus.com
Subject: Re: friend template class
Date: Thu, 29 Oct 1998 19:35:00 -0000 [thread overview]
Message-ID: <363903D6.7D5065C9@cygnus.com> (raw)
In-Reply-To: <36382F32.365E283.cygnus.egcs@iis.fhg.de>
Christian Kueblbeck wrote:
>
> The following piece of code does not compile:
>
> template <class T> class Test
> {
> friend class Friend<T>;
> };
>
> g++ 2.7.1 compiles without warning (as well as MS Visual C++), but egcs
> says:
>
> parse error before `<'
>
> How else should I declare friend template class?
You need to declare Friend as a template outside Test
before you declare an instance of it as a friend inside
Test. This compiles on egcs:
template <class T> struct A;
template <class T> struct B { friend struct A<T>; };
Nathan Myers
ncm@cantrip.org
next parent reply other threads:[~1998-10-29 19:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <36382F32.365E283.cygnus.egcs@iis.fhg.de>
1998-10-29 19:35 ` Nathan Myers [this message]
1998-10-29 1:09 Christian Kueblbeck
1998-10-29 18:23 ` Alexandre Oliva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=363903D6.7D5065C9@cygnus.com \
--to=ncm@cygnus.com \
--cc=egcs@cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).