IBM Support

IY78555: 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

    IY78555

  • Reported component name

    XLC AIX

  • Reported component ID

    5724I1000

  • Reported release

    700

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2005-11-04

  • Closed date

    2006-01-18

  • Last modified date

    2007-08-02

Fix information

  • Fixed component name

    XLC AIX

  • Fixed component ID

    5724I1000

Applicable component levels

  • R700 PSY U812862

       UP07/08/02 I 1000

[{"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":"7.0"}]

Document Information

Modified date:
03 October 2021