public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13495] New: Impossible "friend"-ship to nested template
@ 2003-12-27  7:46 sstrasser at systemhaus-gruppe dot de
  2003-12-27 16:45 ` [Bug c++/13495] Friendship to class nested withint a template is broken giovannibajo at libero dot it
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: sstrasser at systemhaus-gruppe dot de @ 2003-12-27  7:46 UTC (permalink / raw)
  To: gcc-bugs

[-- 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


^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <bug-13495-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2021-04-22 17:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-27  7:46 [Bug c++/13495] New: Impossible "friend"-ship to nested template sstrasser at systemhaus-gruppe dot de
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
     [not found] <bug-13495-4@http.gcc.gnu.org/bugzilla/>
2021-04-22 17:45 ` ppalka at gcc dot gnu.org

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).