This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/13495] New: Impossible "friend"-ship to nested template


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]