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

             Bug #: 52965
           Summary: c++11 - subclass is private, but g++ ignores access
                    modifier when using auto
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: jwcac...@yahoo.com


/*
   Is this a bug, that g++ ignores the private access modifier when using "auto
type deduction"?
   Compile with g++ -std=c++0x private_access.cpp
             vs g++ -std=c++0x private_access.cpp -DUSE_AUTO

   This seems similar to bug 52816
*/

class C
{
private:
   class PVT { };
public:
   PVT p() { return PVT(); };
};

int main(int, char*[])
{
   C c;
#ifdef USE_AUTO
   auto p = c.p();          // why does this work (in c++11)
#else
   C::PVT p = c.p();        // but this reports that C::PVT is private?
#endif
   return 0;
};

Reply via email to