public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sstrasser at systemhaus-gruppe dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/13495] New: Impossible "friend"-ship to nested template
Date: Sat, 27 Dec 2003 07:46:00 -0000	[thread overview]
Message-ID: <20031227022232.13495.sstrasser@systemhaus-gruppe.de> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1540 bytes --]

Hi.
I don´t exactly know what the correct syntax to do this is, since I couldn´t
look up in the specification, but it looks like a bug because
a) I couldn´t figure out a way to do this with GCC
b) I could figure out a way which does work with MSVC but doesn´t with GCC

so here it is:

a template class which contains a nested class which itself is no template but
inherits the template parameter:

template<typename T>
class A{
public:
  class B{};
};

class A<T>::B should be friend of another class:

template<typename T>
class OtherClass{
  XXX
};

A<T>::B is a dependent type, so using it requires the 'typename'-keyword.
("implicit typename deprecated")

a) XXX == friend typename A<T>::B; doesn´t work because it requires the
'class'-keyword because it´s a class friendship

b) XXX == friend class A<T>::B; doesn´t work because A<T>::B is a dependent
typename, which requires the 'typename' keyword.

c) XXX == friend typename class A<T>::B; or 
d) XXX == friend class typename A<T>::B pass out with parse error.

MSVC compiles a) (wrongly) and c) (possibly correct)

Thank you,

Stefan

-- 
           Summary: Impossible "friend"-ship to nested template
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sstrasser at systemhaus-gruppe dot de
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13495


             reply	other threads:[~2003-12-27  2:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-27  7:46 sstrasser at systemhaus-gruppe dot de [this message]
2003-12-27 16:45 ` [Bug c++/13495] Friendship to class nested withint a template is broken giovannibajo at libero dot it
2004-02-23 15:40 ` lerdsuwa at gcc dot gnu dot org
2004-08-30 15:33 ` giovannibajo at libero dot it
2004-08-31 10:56 ` lerdsuwa at gcc dot gnu dot org
2004-09-04 15:59 ` lerdsuwa at gcc dot gnu dot org
2004-09-06 15:56 ` lerdsuwa at gcc dot gnu dot org
2004-10-20 16:21 ` [Bug c++/13495] Friendship to class nested within " cvs-commit at gcc dot gnu dot org
2004-10-20 16:25 ` lerdsuwa at gcc dot gnu dot org

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=20031227022232.13495.sstrasser@systemhaus-gruppe.de \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).