public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/13495] Friendship to class nested within a template is broken [not found] <bug-13495-4@http.gcc.gnu.org/bugzilla/> @ 2021-04-22 17:45 ` ppalka at gcc dot gnu.org 0 siblings, 0 replies; 3+ messages in thread From: ppalka at gcc dot gnu.org @ 2021-04-22 17:45 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=13495 Bug 13495 depends on bug 16617, which changed state. Bug 16617 Summary: Fail to do access checking correctly for non-dependent qualified-id https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16617 What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/13495] New: Impossible "friend"-ship to nested template @ 2003-12-27 7:46 sstrasser at systemhaus-gruppe dot de 2004-10-20 16:21 ` [Bug c++/13495] Friendship to class nested within a template is broken cvs-commit at gcc dot gnu dot org 2004-10-20 16:25 ` lerdsuwa at gcc dot gnu dot org 0 siblings, 2 replies; 3+ 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] 3+ messages in thread
* [Bug c++/13495] Friendship to class nested within a template is broken 2003-12-27 7:46 [Bug c++/13495] New: Impossible "friend"-ship to nested template sstrasser at systemhaus-gruppe dot de @ 2004-10-20 16:21 ` cvs-commit at gcc dot gnu dot org 2004-10-20 16:25 ` lerdsuwa at gcc dot gnu dot org 1 sibling, 0 replies; 3+ messages in thread From: cvs-commit at gcc dot gnu dot org @ 2004-10-20 16:21 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-10-20 16:20 ------- Subject: Bug 13495 CVSROOT: /cvs/gcc Module name: gcc Changes by: lerdsuwa@gcc.gnu.org 2004-10-20 16:20:51 Modified files: gcc/cp : ChangeLog cp-tree.h decl.c friend.c parser.c pt.c gcc/testsuite : ChangeLog gcc/testsuite/g++.old-deja/g++.pt: friend44.C Added files: gcc/testsuite/g++.dg/template: memfriend9.C memfriend10.C memfriend11.C memfriend12.C memfriend13.C memfriend14.C memfriend15.C memfriend16.C memfriend17.C Log message: PR c++/13495 * decl.c (make_unbound_class_template): Add PARM_LIST parameter. * cp-tree.h (make_unbound_class_template): Adjust prototype. * parser.c (cp_parser_lookup_name): Adjust call to make_unbound_class_template. (cp_parser_single_declaration): Handle member class of class template as template friend parsing correctly. * friend.c (is_friend): Call is_specialization_of_friend for template friend class. (make_friend_class): Handle member class of class template as template friend. * pt.c (is_specialization_of_friend): Likewise. (instantiate_class_template): Likewise. (tsubst): Adjust call to make_unbound_class_template. * g++.dg/template/memfriend9.C: New test. * g++.dg/template/memfriend10.C: Likewise. * g++.dg/template/memfriend11.C: Likewise. * g++.dg/template/memfriend12.C: Likewise. * g++.dg/template/memfriend13.C: Likewise. * g++.dg/template/memfriend14.C: Likewise. * g++.dg/template/memfriend15.C: Likewise. * g++.dg/template/memfriend16.C: Likewise. * g++.dg/template/memfriend17.C: Likewise. * g++.old-deja/g++.pt/friend44.C: Remove bogus error. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4447&r2=1.4448 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1065&r2=1.1066 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1316&r2=1.1317 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/friend.c.diff?cvsroot=gcc&r1=1.101&r2=1.102 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.267&r2=1.268 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.936&r2=1.937 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4478&r2=1.4479 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/memfriend9.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/memfriend10.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/memfriend11.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/memfriend12.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/memfriend13.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/memfriend14.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/memfriend15.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/memfriend16.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/memfriend17.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.pt/friend44.C.diff?cvsroot=gcc&r1=1.3&r2=1.4 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13495 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/13495] Friendship to class nested within a template is broken 2003-12-27 7:46 [Bug c++/13495] New: Impossible "friend"-ship to nested template sstrasser at systemhaus-gruppe dot de 2004-10-20 16:21 ` [Bug c++/13495] Friendship to class nested within a template is broken cvs-commit at gcc dot gnu dot org @ 2004-10-20 16:25 ` lerdsuwa at gcc dot gnu dot org 1 sibling, 0 replies; 3+ messages in thread From: lerdsuwa at gcc dot gnu dot org @ 2004-10-20 16:25 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2004-10-20 16:25 ------- I am closing this as fixed by patch: http://gcc.gnu.org/ml/gcc-patches/2004-10/msg01709.html For access checking problem mentioned in the comments, it's already covered in PR16617. That part requires some structural changes that won't be investigated for some time. -- What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED Target Milestone|--- |4.0.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13495 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-22 17:45 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <bug-13495-4@http.gcc.gnu.org/bugzilla/> 2021-04-22 17:45 ` [Bug c++/13495] Friendship to class nested within a template is broken ppalka at gcc dot gnu.org 2003-12-27 7:46 [Bug c++/13495] New: Impossible "friend"-ship to nested template sstrasser at systemhaus-gruppe dot de 2004-10-20 16:21 ` [Bug c++/13495] Friendship to class nested within a template is broken cvs-commit at gcc dot gnu dot org 2004-10-20 16:25 ` lerdsuwa at gcc dot gnu dot 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).