public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/62240] New: A using-declaration within a class can publish a public base of a private base.
@ 2014-08-23 14:27 rohan at rohanlean dot de
  2014-08-26 11:15 ` [Bug c++/62240] " redi at gcc dot gnu.org
  2024-01-09  4:09 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: rohan at rohanlean dot de @ 2014-08-23 14:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 62240
           Summary: A using-declaration within a class can publish a
                    public base of a private base.
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rohan at rohanlean dot de

Created attachment 33384
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33384&action=edit
small testcase

Suppose that three classes are related by inheritance (B ---> A : B inherits
from A) as follows:

  C ---private--> B ---public--> A

Then C can publish A via

  using B::A;

I think that the correct behaviour is to reject such a program.


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

* [Bug c++/62240] A using-declaration within a class can publish a public base of a private base.
  2014-08-23 14:27 [Bug c++/62240] New: A using-declaration within a class can publish a public base of a private base rohan at rohanlean dot de
@ 2014-08-26 11:15 ` redi at gcc dot gnu.org
  2024-01-09  4:09 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2014-08-26 11:15 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-08-26
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Agreed, the attached code (repeated below) should be rejected.


class A {};

class B : public A {};

class C : B
{
public:
  using B::A;
};

int main()
{
  A *p = new C;
}


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

* [Bug c++/62240] A using-declaration within a class can publish a public base of a private base.
  2014-08-23 14:27 [Bug c++/62240] New: A using-declaration within a class can publish a public base of a private base rohan at rohanlean dot de
  2014-08-26 11:15 ` [Bug c++/62240] " redi at gcc dot gnu.org
@ 2024-01-09  4:09 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-09  4:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jlame646 at gmail dot com

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 113286 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2024-01-09  4:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-23 14:27 [Bug c++/62240] New: A using-declaration within a class can publish a public base of a private base rohan at rohanlean dot de
2014-08-26 11:15 ` [Bug c++/62240] " redi at gcc dot gnu.org
2024-01-09  4:09 ` 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).