IBM Support

IZ55630: COMILE 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 for the following test case:
    
    ===== TESTCASE:
    $ cat test.cpp
    #include <memory>
    int main() {
            std::tr1::shared_ptr<int const> ptr;
            if (ptr) {}
            return 0;
    }
    
    
    ===== ACTUAL OUTPUT:
    $xlC test.cpp -D__IBMCPP_TR1__
    "/usr/vacpp/include/memory", line 850.34: 1540-0258 (S)
    A return value of type "void *" cannot be initialized with an
    expression of type "const int *".
    "usr/vacpp/include/memory", line 848.9: 1540-0700 (I)
    The previous message was produced while processing
    "std::tr1::shared_ptr<const int>::operator void *() const".
    "test.cpp", line 4.13: 1540-0700 (I) The previous message was
    produced while processing "main()".
    
    ===== EXPECTED OUTPUT:
    Should compile clean
    

Local fix

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

Problem summary

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

Problem conclusion

  • The library class has been updated to allow
    this.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IZ55630

  • 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-07-20

  • Closed date

    2009-08-10

  • Last modified date

    2009-11-26

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

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

    LI75062 LI75063 LI75064

Fix information

  • Fixed component name

    XL C++ AIX

  • Fixed component ID

    5724U8100

Applicable component levels

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

Document Information

Modified date:
26 November 2009