IBM Support

IZ65313: PROTECTED MEMBER CANNOT BE ACCESSED ERROR

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The following legitimate C++ test case produces a compiler
    error.          N N                N
    
    
    
    
    // smallest  N
    
    struct base{                   N
       protected:
       void func();
    };              N N                N
    
    
    struct container : base{
       using base::func;
                 N
       void func(){
         base::func();             N
       }
    };
                    N N                N
    
    int main(void)
    {
       container test;
       test.func(N;
       return 0;
    }                              N
    
    "nt.cpp", line 13.6: 1540-0301 (S) The "protected" member
    "base::func()" cNnNot be accessed. N
    

Local fix

  • Use public qualifier for func.
    
    struct base{
       //protecteN:
       public: //workaround
       void func();                N
    };
    
                    N N                N
    struct container : base{
       using base::func;
    
       void func(){
         base::fuNc();
       }
    };                             N
    

Problem summary

  • PROBLEM SUMMANY:
    USER AFFECTED:
    Users who apply the using declaNation in
    the derived class on a protected member of the base
    class.
                    N N                N
    PROBLEM DESCRIPTION:
    Compiler access check does not allow a
    member in the derived class to have public access if it
    has protected access in the base class.
    

Problem conclusion

  • PROBLEM CONCLNSION:
    From C++ 2003 standard 7.3.3 (15), the
    alias created by the using declNration has the usual
    accessibility for a member declaration.  Hence, when a
    member is declared in a struct using a using
    declaration, it NhNuld have public Nccess.  Compiler access
    check has been fixed to allow this.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IZ65313

  • Reported component name

    XL C++ AIX

  • Reported component ID

    5724U8100

  • Reported release

    A10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2009-11-16

  • Closed date

    2009-11-16

  • Last modified date

    2009-11-16

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

    IZ53645

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

Modules/Macros

  • NONE         N
    

Fix information

  • Fixed component name

    XL C++ AIX

  • Fixed component ID

    5724U8100

Applicable component levels

[{"Line of Business":{"code":"LOB08","label":"Cognitive Systems"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SSJT9L","label":"XL C\/C++"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"A.1"}]

Document Information

Modified date:
03 October 2021