public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/64961] New: nested template implementation crossing namespace fails with access error @ 2015-02-06 14:05 eugene at hutorny dot in.ua 2015-02-10 13:37 ` [Bug c++/64961] " redi at gcc dot gnu.org ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: eugene at hutorny dot in.ua @ 2015-02-06 14:05 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64961 Bug ID: 64961 Summary: nested template implementation crossing namespace fails with access error Product: gcc Version: 4.8.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: eugene at hutorny dot in.ua Created attachment 34686 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34686&action=edit code sample illustrating the issue Consider a case: a template with protected nested structure (Foo<>::Fo) is defined in one namespace (foo), and instantiated in another namespace (bar) via inheritance. Specialization of nested templates methods fails with access error. Compare to specialization of a outer template's method placed in exactly the same scope and compiled with success. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/64961] nested template implementation crossing namespace fails with access error 2015-02-06 14:05 [Bug c++/64961] New: nested template implementation crossing namespace fails with access error eugene at hutorny dot in.ua @ 2015-02-10 13:37 ` redi at gcc dot gnu.org 2015-02-10 13:39 ` redi at gcc dot gnu.org ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: redi at gcc dot gnu.org @ 2015-02-10 13:37 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64961 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- Clang gives exactly the same error. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/64961] nested template implementation crossing namespace fails with access error 2015-02-06 14:05 [Bug c++/64961] New: nested template implementation crossing namespace fails with access error eugene at hutorny dot in.ua 2015-02-10 13:37 ` [Bug c++/64961] " redi at gcc dot gnu.org @ 2015-02-10 13:39 ` redi at gcc dot gnu.org 2015-02-10 14:15 ` eugene at hutorny dot in.ua ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: redi at gcc dot gnu.org @ 2015-02-10 13:39 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64961 --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- And I think the code is invalid. If you want to define the function, don't use a protected access path. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/64961] nested template implementation crossing namespace fails with access error 2015-02-06 14:05 [Bug c++/64961] New: nested template implementation crossing namespace fails with access error eugene at hutorny dot in.ua 2015-02-10 13:37 ` [Bug c++/64961] " redi at gcc dot gnu.org 2015-02-10 13:39 ` redi at gcc dot gnu.org @ 2015-02-10 14:15 ` eugene at hutorny dot in.ua 2015-02-10 16:49 ` redi at gcc dot gnu.org 2021-12-10 7:35 ` pinskia at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: eugene at hutorny dot in.ua @ 2015-02-10 14:15 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64961 --- Comment #3 from Eugene <eugene at hutorny dot in.ua> --- In the example method bar::Bar::Foo<1>::bar() is on the same access path and its specialization gives no error. Is there an explanation for this difference? ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/64961] nested template implementation crossing namespace fails with access error 2015-02-06 14:05 [Bug c++/64961] New: nested template implementation crossing namespace fails with access error eugene at hutorny dot in.ua ` (2 preceding siblings ...) 2015-02-10 14:15 ` eugene at hutorny dot in.ua @ 2015-02-10 16:49 ` redi at gcc dot gnu.org 2021-12-10 7:35 ` pinskia at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: redi at gcc dot gnu.org @ 2015-02-10 16:49 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64961 --- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- No it isn't the same. Foo<1> is a public member of bar::Bar ([class]/2 "For purposes of access checking, the injected-class-name is treated as if it were a public member name.") Ba is a protected member of bar::Bar. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/64961] nested template implementation crossing namespace fails with access error 2015-02-06 14:05 [Bug c++/64961] New: nested template implementation crossing namespace fails with access error eugene at hutorny dot in.ua ` (3 preceding siblings ...) 2015-02-10 16:49 ` redi at gcc dot gnu.org @ 2021-12-10 7:35 ` pinskia at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu.org @ 2021-12-10 7:35 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64961 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2021-12-10 --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. I think GCC is doing access checks too soon in this case. For a function definition, I don't think access checking applies. bar::Bar::Ba::Fo::foo is the same as Foo<1>::Fo::foo which should be valid to define in the foo namespace. ICC, clang and MSVC all accept the code. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-12-10 7:35 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-02-06 14:05 [Bug c++/64961] New: nested template implementation crossing namespace fails with access error eugene at hutorny dot in.ua 2015-02-10 13:37 ` [Bug c++/64961] " redi at gcc dot gnu.org 2015-02-10 13:39 ` redi at gcc dot gnu.org 2015-02-10 14:15 ` eugene at hutorny dot in.ua 2015-02-10 16:49 ` redi at gcc dot gnu.org 2021-12-10 7:35 ` pinskia 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).