This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/22618] New: Template non-type arguments break class access protection
- From: "squell at alumina dot nl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Jul 2005 20:15:35 -0000
- Subject: [Bug c++/22618] New: Template non-type arguments break class access protection
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
In the below code fragment, the lines marked "OK ??" should
be errors because the outside world does not have access, but
g++ 3.4 and g++ 4.0 (tested on two platforms) allow this.
Especially note the apparent interaction between function
overloading and access protection in this case.
class foo {
typedef int (foo::*memfun)();
int mf(int); // overloaded memebr
int mf();
int mg(); // non overloaded member
};
template<foo::memfun> // OK, but access to foo::memfun ??
struct fm_obj {
// something ..
};
fm_obj<&foo::mf> a; // OK ??
fm_obj<&foo::mg> b; // ERROR: foo::g is private
--
Summary: Template non-type arguments break class access
protection
Product: gcc
Version: 3.4.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: squell at alumina dot nl
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22618