public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106377] New: A injected-class-name of a private class is not accessible in the member of the derived class.
@ 2022-07-21  5:16 xmh970252187 at gmail dot com
  2022-08-09  2:01 ` [Bug c++/106377] A injected-class-name with class/struct key " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: xmh970252187 at gmail dot com @ 2022-07-21  5:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106377

            Bug ID: 106377
           Summary: A injected-class-name of a private class is not
                    accessible in the member of the derived class.
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xmh970252187 at gmail dot com
  Target Milestone: ---

struct B{};
struct C:private B{
};
struct D:C{
    void show(){
        struct B b;
    }
};

This example is accepted by GCC but Clang rejects it. The injected-class-name
of `B` would be accessible as a private member of `C`, which is not accessible
in the member of `D` as per [class.access.base] p4. 

Further, [class.access] says 

> Access control is applied uniformly to declarations and expressions.

> The interpretation of a given construct is established without regard to access control. If the interpretation established makes use of inaccessible members or base classes, the construct is ill-formed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/106377] A injected-class-name with class/struct key of a private class is not accessible in the member of the derived class.
  2022-07-21  5:16 [Bug c++/106377] New: A injected-class-name of a private class is not accessible in the member of the derived class xmh970252187 at gmail dot com
@ 2022-08-09  2:01 ` pinskia at gcc dot gnu.org
  2022-08-09  2:08 ` pinskia at gcc dot gnu.org
  2022-08-09  2:12 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-09  2:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106377

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-08-09
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
            Summary|A injected-class-name of a  |A injected-class-name with
                   |private class is not        |class/struct key of a
                   |accessible in the member of |private class is not
                   |the derived class.          |accessible in the member of
                   |                            |the derived class.

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks like the problem is only with the class/struct key; without the struct
(or class) keyword, GCC correctly rejects it.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/106377] A injected-class-name with class/struct key of a private class is not accessible in the member of the derived class.
  2022-07-21  5:16 [Bug c++/106377] New: A injected-class-name of a private class is not accessible in the member of the derived class xmh970252187 at gmail dot com
  2022-08-09  2:01 ` [Bug c++/106377] A injected-class-name with class/struct key " pinskia at gcc dot gnu.org
@ 2022-08-09  2:08 ` pinskia at gcc dot gnu.org
  2022-08-09  2:12 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-09  2:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106377

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=29040

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I suspect this is the same issue as PR 29040. see bug 29040 comment #2 which
describes basically the same thing I found.

Note ICC warns about this code being done for compability reasons with cfront
too (basically the long history of GCC and even pre-standard C++ has left some
things like this around).

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/106377] A injected-class-name with class/struct key of a private class is not accessible in the member of the derived class.
  2022-07-21  5:16 [Bug c++/106377] New: A injected-class-name of a private class is not accessible in the member of the derived class xmh970252187 at gmail dot com
  2022-08-09  2:01 ` [Bug c++/106377] A injected-class-name with class/struct key " pinskia at gcc dot gnu.org
  2022-08-09  2:08 ` pinskia at gcc dot gnu.org
@ 2022-08-09  2:12 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-09  2:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106377

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Turns out this is a dup of bug 65520.

*** This bug has been marked as a duplicate of bug 65520 ***

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-09  2:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-21  5:16 [Bug c++/106377] New: A injected-class-name of a private class is not accessible in the member of the derived class xmh970252187 at gmail dot com
2022-08-09  2:01 ` [Bug c++/106377] A injected-class-name with class/struct key " pinskia at gcc dot gnu.org
2022-08-09  2:08 ` pinskia at gcc dot gnu.org
2022-08-09  2:12 ` 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).