IBM Support

LI71452: Compiler rejects const_cast for an array

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • Compiler reports error for the following test case. It compiles
    fine if a scalar int is used.
    
    
    typedef int IntArray[2];
    
    void fakeFunc(IntArray &) { }
    
    void constCastArray() {
       const IntArray i = { 1, 2 };
       fakeFunc(const_cast<IntArray &>(i));
    }
    
    $ xlC const_int_array_test.cxx
    "const_int_array_test.hxx", line 5.41: 1540-0216 (S) An
    expression of type "const IntArray" cannot be converted to type
    "IntArray &".
    

Local fix

  • n/a
    

Problem summary

  • Compiler incorrectly flags the construct in question.
    

Problem conclusion

  • Compiler has been corrected to handle the construct per
    language standard and it will not give diagnostic message any
    further.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI71452

  • Reported component name

    XLC/C++ SLES9

  • Reported component ID

    5724M1600

  • Reported release

    800

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2006-09-12

  • Closed date

    2006-09-12

  • Last modified date

    2006-09-12

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

    IY78555

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

Fix information

  • Fixed component name

    XLC/C++ SLES9

  • Fixed component ID

    5724M1600

Applicable component levels

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

Document Information

Modified date:
15 October 2021