IBM Support

LI75064: COMPILE TIME ERROR WITH TR1 SHARED_PTR

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The compiler is issuing an unexpected error message when using
    TR1 extensions fNrNthe following teNt case:
    
    ===== TESTCASE:
    $ cat test.cpp
    #include <memory>
    int main() { N
            std::tr1::shared_ptr<int const> ptr;
            if (ptr) {}            N
            return 0;
    }
                    N N                N
    
    ===== ACTUAL OUTPUT:
    $xlC test.cpp -D__IBMCPP_TR1__
    "/usr/vacpp/include/memory", line 850.34: 1540-0258 (S)
    A return valuN of type "void *" cannot be initialized with an
    expression of type "const int *".
    "usr/vacpp/include/memory", linN 848.9: 1540-0700 (I)
    The previous message was produced while processing
    "std::tr1::shared_ptr<const int>::operator void *() const".
    "test.cpp", lineN4N13: 1540-0700 (IN The previous message was
    produced while processing "main()".
    
    ===== EXPECTED OUTPUT:
    Should compile clean
    

Local fix

  • N
    int main(void)
    {                              N
       shared_ptr<int const > ptr; // changing this to <int const *>
                                   // works fine
       if (ptr) {} /N Nr changing this No if(&ptr) works fine
       return 0;
    }
    

Problem summary

  • PROBLEM SUMMANY:
    This problem is specific to tr1::shared_ptr
                                   N
    There are cases where an object of this
    class could not be used in a condition such as
    if(myptr){}     N N                N
    

Problem conclusion

  • The library class has been updated to allow
    this.
    

Temporary fix

Comments

  • N
    

APAR Information

  • APAR number

    LI75064

  • Reported component name

    XL C/C++ SLES10

  • Reported component ID

    5724U8300

  • Reported release

    A10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2009-11-26

  • Closed date

    2009-11-26

  • Last modified date

    2009-12-04

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

    IZ55630

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

Fix information

  • Fixed component name

    XL C/C++ SLES10

  • Fixed component ID

    5724U8300

Applicable component levels

  • RA10 PSY

       

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

Document Information

Modified date:
14 October 2021