public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11174] New: derived class can access protected base class member function through pointer to member function
@ 2003-06-12 12:59 mike.reed@amadron.com
2003-06-12 15:36 ` [Bug c++/11174] " giovannibajo@libero.it
` (14 more replies)
0 siblings, 15 replies; 16+ messages in thread
From: mike.reed@amadron.com @ 2003-06-12 12:59 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11174
Summary: derived class can access protected base class member
function through pointer to member function
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mike.reed@amadron.com
CC: gcc-bugs@gcc.gnu.org
Reading specs from /usr/gcc3local/lib/gcc-lib/i686-pc-linux-gnu/3.3/specs
Configured with: ../gcc-3.3/configure --prefix=/usr/gcc3local
--enable-languages=c,c++
Thread model: posix
gcc version 3.3
With the following code:
class A {
protected:
void foo() {}
public:
A();
};
class B : public A {
void bar() {
A a;
a.foo();
void (A::*pmf)() = &A::foo; // 1
(a.*pmf)(); // 2
}
};
Compilation gives:
g++ -W -Wall -ansi -pedantic -c pmf.cpp
pmf.cpp: In member function `void B::bar()':
pmf.cpp:3: error: `void A::foo()' is protected
pmf.cpp:12: error: within this context
Compilation exited abnormally with code 1 at Thu Jun 12 10:28:26
But note that I am able to call the protected member function of the external
object via a pointer to member function (PMF).
Looking at the C++ spec (11.5 example see void D2::mem...) I think the line
labelled 1 should be ill-formed but since the compiler doesn't think so I am
able to gain access to the protected function on the line labelled 2.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/11174] derived class can access protected base class member function through pointer to member function
2003-06-12 12:59 [Bug c++/11174] New: derived class can access protected base class member function through pointer to member function mike.reed@amadron.com
@ 2003-06-12 15:36 ` giovannibajo@libero.it
2003-06-15 13:54 ` lerdsuwa@gcc.gnu.org
` (13 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: giovannibajo@libero.it @ 2003-06-12 15:36 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 895 bytes --]
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11174
giovannibajo@libero.it changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-06-12 15:36:40
date| |
------- Additional Comments From giovannibajo@libero.it 2003-06-12 15:36 -------
Confirmed. Reduced snippet:
---------------------------------
struct A
{
protected:
int a;
};
struct B : A
{
void foo()
{
(void)&A::a;
}
};
---------------------------------
This is accepted by any version of GCC but it is ill-formed (see the example in
§11.5).
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/11174] derived class can access protected base class member function through pointer to member function
2003-06-12 12:59 [Bug c++/11174] New: derived class can access protected base class member function through pointer to member function mike.reed@amadron.com
2003-06-12 15:36 ` [Bug c++/11174] " giovannibajo@libero.it
@ 2003-06-15 13:54 ` lerdsuwa@gcc.gnu.org
2003-06-15 13:55 ` lerdsuwa@gcc.gnu.org
` (12 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: lerdsuwa@gcc.gnu.org @ 2003-06-15 13:54 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11174
lerdsuwa@gcc.gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Last reconfirmed|2003-06-12 15:36:40 |2003-06-15 13:54:55
date| |
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/11174] derived class can access protected base class member function through pointer to member function
2003-06-12 12:59 [Bug c++/11174] New: derived class can access protected base class member function through pointer to member function mike.reed@amadron.com
2003-06-12 15:36 ` [Bug c++/11174] " giovannibajo@libero.it
2003-06-15 13:54 ` lerdsuwa@gcc.gnu.org
@ 2003-06-15 13:55 ` lerdsuwa@gcc.gnu.org
2003-08-01 15:25 ` lerdsuwa at gcc dot gnu dot org
` (11 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: lerdsuwa@gcc.gnu.org @ 2003-06-15 13:55 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11174
lerdsuwa@gcc.gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.4 |---
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/11174] derived class can access protected base class member function through pointer to member function
2003-06-12 12:59 [Bug c++/11174] New: derived class can access protected base class member function through pointer to member function mike.reed@amadron.com
` (2 preceding siblings ...)
2003-06-15 13:55 ` lerdsuwa@gcc.gnu.org
@ 2003-08-01 15:25 ` lerdsuwa at gcc dot gnu dot org
2003-08-18 14:03 ` lerdsuwa at gcc dot gnu dot org
` (10 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2003-08-01 15:25 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11174
lerdsuwa at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |3.4
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/11174] derived class can access protected base class member function through pointer to member function
2003-06-12 12:59 [Bug c++/11174] New: derived class can access protected base class member function through pointer to member function mike.reed@amadron.com
` (3 preceding siblings ...)
2003-08-01 15:25 ` lerdsuwa at gcc dot gnu dot org
@ 2003-08-18 14:03 ` lerdsuwa at gcc dot gnu dot org
2003-08-19 12:55 ` lerdsuwa at gcc dot gnu dot org
` (9 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2003-08-18 14:03 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11174
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2003-08-18 14:03 -------
Patch submitted:
http://gcc.gnu.org/ml/gcc-patches/2003-08/msg00998.html
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/11174] derived class can access protected base class member function through pointer to member function
2003-06-12 12:59 [Bug c++/11174] New: derived class can access protected base class member function through pointer to member function mike.reed@amadron.com
` (4 preceding siblings ...)
2003-08-18 14:03 ` lerdsuwa at gcc dot gnu dot org
@ 2003-08-19 12:55 ` lerdsuwa at gcc dot gnu dot org
2003-08-19 12:55 ` cvs-commit at gcc dot gnu dot org
` (8 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2003-08-19 12:55 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11174
lerdsuwa at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2003-08-19 12:55 -------
Fixed in the main trunk.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/11174] derived class can access protected base class member function through pointer to member function
2003-06-12 12:59 [Bug c++/11174] New: derived class can access protected base class member function through pointer to member function mike.reed@amadron.com
` (5 preceding siblings ...)
2003-08-19 12:55 ` lerdsuwa at gcc dot gnu dot org
@ 2003-08-19 12:55 ` cvs-commit at gcc dot gnu dot org
2003-09-01 3:54 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-08-19 12:55 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11174
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2003-08-19 12:55 -------
Subject: Bug 11174
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: lerdsuwa@gcc.gnu.org 2003-08-19 12:55:00
Modified files:
gcc/cp : ChangeLog init.c
gcc/testsuite : ChangeLog
gcc/testsuite/g++.old-deja/g++.jason: access17.C
Added files:
gcc/testsuite/g++.dg/parse: access4.C access5.C
Log message:
PR c++/11174
* init.c (build_offset_ref): Perform access checking for
pointer to member correctly.
* g++.dg/parse/access4.C: New test.
* g++.dg/parse/access5.C: Likewise.
* g++.old-deja/g++.jason/access17.C: Adjust error message.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3608&r2=1.3609
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&r1=1.339&r2=1.340
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2976&r2=1.2977
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/access4.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/access5.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.jason/access17.C.diff?cvsroot=gcc&r1=1.5&r2=1.6
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/11174] derived class can access protected base class member function through pointer to member function
2003-06-12 12:59 [Bug c++/11174] New: derived class can access protected base class member function through pointer to member function mike.reed@amadron.com
` (6 preceding siblings ...)
2003-08-19 12:55 ` cvs-commit at gcc dot gnu dot org
@ 2003-09-01 3:54 ` pinskia at gcc dot gnu dot org
2004-04-08 18:43 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-01 3:54 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11174
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |richard dot kreckel at ginac
| |dot de
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-09-01 03:54 -------
*** Bug 12119 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/11174] derived class can access protected base class member function through pointer to member function
2003-06-12 12:59 [Bug c++/11174] New: derived class can access protected base class member function through pointer to member function mike.reed@amadron.com
` (7 preceding siblings ...)
2003-09-01 3:54 ` pinskia at gcc dot gnu dot org
@ 2004-04-08 18:43 ` pinskia at gcc dot gnu dot org
2004-05-06 12:36 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-08 18:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-04-08 18:43 -------
*** Bug 14894 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |sebor at roguewave dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11174
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/11174] derived class can access protected base class member function through pointer to member function
2003-06-12 12:59 [Bug c++/11174] New: derived class can access protected base class member function through pointer to member function mike.reed@amadron.com
` (8 preceding siblings ...)
2004-04-08 18:43 ` pinskia at gcc dot gnu dot org
@ 2004-05-06 12:36 ` pinskia at gcc dot gnu dot org
2004-05-16 21:39 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-06 12:36 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-06 12:36 -------
*** Bug 15308 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |smelkov at mph1 dot phys dot
| |spbu dot ru
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11174
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/11174] derived class can access protected base class member function through pointer to member function
2003-06-12 12:59 [Bug c++/11174] New: derived class can access protected base class member function through pointer to member function mike.reed@amadron.com
` (9 preceding siblings ...)
2004-05-06 12:36 ` pinskia at gcc dot gnu dot org
@ 2004-05-16 21:39 ` pinskia at gcc dot gnu dot org
2004-05-18 11:08 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-16 21:39 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-15 18:25 -------
*** Bug 15468 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |murrayc at murrayc dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11174
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/11174] derived class can access protected base class member function through pointer to member function
2003-06-12 12:59 [Bug c++/11174] New: derived class can access protected base class member function through pointer to member function mike.reed@amadron.com
` (10 preceding siblings ...)
2004-05-16 21:39 ` pinskia at gcc dot gnu dot org
@ 2004-05-18 11:08 ` pinskia at gcc dot gnu dot org
2004-05-18 11:10 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-18 11:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-17 19:17 -------
Reopening for documentation.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Keywords| |documentation
Resolution|FIXED |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11174
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/11174] derived class can access protected base class member function through pointer to member function
2003-06-12 12:59 [Bug c++/11174] New: derived class can access protected base class member function through pointer to member function mike.reed@amadron.com
` (11 preceding siblings ...)
2004-05-18 11:08 ` pinskia at gcc dot gnu dot org
@ 2004-05-18 11:10 ` pinskia at gcc dot gnu dot org
2004-05-18 11:38 ` giovannibajo at libero dot it
2004-05-26 12:29 ` pinskia at gcc dot gnu dot org
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-18 11:10 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|lerdsuwa at gcc dot gnu dot |giovannibajo at libero dot
|org |it
Status|REOPENED |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11174
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/11174] derived class can access protected base class member function through pointer to member function
2003-06-12 12:59 [Bug c++/11174] New: derived class can access protected base class member function through pointer to member function mike.reed@amadron.com
` (12 preceding siblings ...)
2004-05-18 11:10 ` pinskia at gcc dot gnu dot org
@ 2004-05-18 11:38 ` giovannibajo at libero dot it
2004-05-26 12:29 ` pinskia at gcc dot gnu dot org
14 siblings, 0 replies; 16+ messages in thread
From: giovannibajo at libero dot it @ 2004-05-18 11:38 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-05-17 19:30 -------
I'll take care of writing up changes.html/bugs.html for this. It affects more
than pointer-to-members, and appears to be a FAQ.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11174
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/11174] derived class can access protected base class member function through pointer to member function
2003-06-12 12:59 [Bug c++/11174] New: derived class can access protected base class member function through pointer to member function mike.reed@amadron.com
` (13 preceding siblings ...)
2004-05-18 11:38 ` giovannibajo at libero dot it
@ 2004-05-26 12:29 ` pinskia at gcc dot gnu dot org
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-26 12:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-25 14:38 -------
Closing this one as PR 14949 is the one for the documenation.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11174
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2004-05-25 14:44 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-12 12:59 [Bug c++/11174] New: derived class can access protected base class member function through pointer to member function mike.reed@amadron.com
2003-06-12 15:36 ` [Bug c++/11174] " giovannibajo@libero.it
2003-06-15 13:54 ` lerdsuwa@gcc.gnu.org
2003-06-15 13:55 ` lerdsuwa@gcc.gnu.org
2003-08-01 15:25 ` lerdsuwa at gcc dot gnu dot org
2003-08-18 14:03 ` lerdsuwa at gcc dot gnu dot org
2003-08-19 12:55 ` lerdsuwa at gcc dot gnu dot org
2003-08-19 12:55 ` cvs-commit at gcc dot gnu dot org
2003-09-01 3:54 ` pinskia at gcc dot gnu dot org
2004-04-08 18:43 ` pinskia at gcc dot gnu dot org
2004-05-06 12:36 ` pinskia at gcc dot gnu dot org
2004-05-16 21:39 ` pinskia at gcc dot gnu dot org
2004-05-18 11:08 ` pinskia at gcc dot gnu dot org
2004-05-18 11:10 ` pinskia at gcc dot gnu dot org
2004-05-18 11:38 ` giovannibajo at libero dot it
2004-05-26 12:29 ` pinskia 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).