IBM Support

PI58813: C++11 AUTO USAGE WITH PRIVATE NESTED CLASSES

A fix is available

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • Usage of the C++11 auto feature to deduce the type of a private
    nested class is emitting an error stating that the member can
    not be accessed.
    
    
    
       === TEST CASE ===
    
    class enclose
    {
        class nested
        {
        public:
            void use() {}
        };
    
        nested _n;
    
     public:
        enclose()
        {
            _n = nested();
        }
    
        nested& getref()     { return _n; }
        nested* getpointer() { return &_n; }
        nested  getval()     { return _n; }
    };
    
    int main()
    {
        enclose e = enclose();
    
        e.getref().use();
        e.getpointer()->use();
        e.getval().use();
    
        auto& n2 = e.getref();       // comment out
        n2.use();                    // to get next error
    
        auto* n3 = e.getpointer();   // comment out
        n3->use();                   // to get next error
    
        auto n4 = e.getval();
        n4.use();
    }
    
    
    
    > xlC test.cpp -qlanglvl=extended0x
    "./test.cpp", line 30.11: CCN5300 (S) The "private" member
    "class enclose::nested" cannot be accessed.
    CCN0793(I) Compilation failed for file ./test.cpp.  Object file
    not created.
    >
    
    > xlC test.cpp -qlanglvl=extended0x
    "./test.cpp", line 33.11: CCN5300 (S) The "private" member
    "class enclose::nested" cannot be accessed.
    CCN0793(I) Compilation failed for file ./test.cpp.  Object file
    not created.
    >
    
    > xlC test.cpp -qlanglvl=extended0x
    "./test.cpp", line 36.10: CCN5300 (S) The "private" member
    "class enclose::nested" cannot be accessed.
    CCN0793(I) Compilation failed for file ./test.cpp.  Object file
    not created.
    >
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED: zOS XLC users of c++ 2011 auto type.         *
    ****************************************************************
    * PROBLEM DESCRIPTION: Access to a private class member from   *
    *                      an auto type that does not name the     *
    *                      private member should be permitted,     *
    *                      the compiler generates a private        *
    *                      access violation error.                 *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    .
    

Problem conclusion

  • Apply provided service.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PI58813

  • Reported component name

    C/C++ FOR MVS

  • Reported component ID

    56551210A

  • Reported release

    7A0

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2016-03-09

  • Closed date

    2016-03-09

  • Last modified date

    2016-06-04

  • APAR is sysrouted FROM one or more of the following:

    PI51318

  • APAR is sysrouted TO one or more of the following:

Modules/Macros

  •    CCNEPP
    

Fix information

  • Fixed component name

    C/C++ FOR MVS

  • Fixed component ID

    56551210A

Applicable component levels

  • R7A0 PSY UI36029

       UP16/04/26 P F604

Fix is available

  • Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SG19M","label":"APARs - z\/OS environment"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7A0","Edition":"","Line of Business":{"code":"","label":""}},{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSQKCWV","label":"IBM C\/C++ for MVS\/ESA"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7A0","Edition":"","Line of Business":{"code":"LOB35","label":"Mainframe SW"}}]

Document Information

Modified date:
22 August 2024