[Bug c++/16413] New: 3.3 regression: operator() of private member accessible

tempa at enigmati dot ca gcc-bugzilla@gcc.gnu.org
Wed Jul 7 18:36:00 GMT 2004


The following simple code snippet is correctly rejected by versions 2.95 and
3.2, but is accepted by 3.3:


class A
{
public:
    int operator()(int i) const { return 0; }
};

class B
{
private:
    A a;
};

int main()
{
        return B().a(0);
}



This happens with both const and non-const operator(), but doesn't seem to
happen with other operators. I tried += and operator[], which both correctly
generated errors.

-- 
           Summary: 3.3 regression: operator() of private member accessible
           Product: gcc
           Version: 3.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tempa at enigmati dot ca
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16413



More information about the Gcc-bugs mailing list