This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/22618] New: Template non-type arguments break class access protection


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]