IBM Support

LI77631: VECTOR DESTRUCTOR NOT RECOGNIZED

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • When compiling the test case below, the compiler incorrectly
    issues an error message when trying to explicitly invoke
    the vector destructor.
    
    ===== COMPILE COMMAND:
    xlC -c test.cpp
    
    ===== TESTCASE:
    $ test.cpp
    #include <vector>
    #include <new>
    using std::vector;
    int main(int argc, char* argv[])
    {
        char buf[1024];
        std::vector<int>* v = new (buf) std::vector<int>(100);
        v->~vector();  // Gets compilation error here
        return 0;
    }
    $
    
    
    ===== ACTUAL OUTPUT:
    $ xlC -c test.cpp
    "test.cpp", line 8.6: 1540-0210 (S) "vector" is not a base
    class of "vector<int,std::allocator<int> >".
    $
    
    
    ===== EXPECTED OUTPUT:
    According to the C++0x standard, this should complile clean.
    For the C++03 standard, it should be a warning.
    

Local fix

  • As a workaround, name the destructor call to explicitly match
    the name of the instantiation
    
    ie change
    v->~vector();
    
    to
    
    v->~vector<int>();
    

Problem summary

  • USERS AFFECTED:
    Users calling a destructor with v.~vector(); where vector is a
    template are affected by this issue.
    
    PROBLEM DESCRIPTION:
    Calling a destructor with v.~vector(); where vector is a
    template is incorrect under the C++2003 language standard but
    correct under the C++2011 language standard.
    To be compatible with other compilers we now issue a warning
    instead of an error in the 2003 language level and compile
    clean in the 2011 language level.
    

Problem conclusion

  • The error has been changed to warning for 2003 language and a
    clean compile for 2011 language level.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI77631

  • Reported component name

    XL C/C++ FOR LI

  • Reported component ID

    5725C7300

  • Reported release

    C10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2013-10-28

  • Closed date

    2013-10-28

  • Last modified date

    2013-10-28

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

    IV46193

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

Fix information

  • Fixed component name

    XL C/C++ FOR LI

  • Fixed component ID

    5725C7300

Applicable component levels



Document information

More support for: XL C/C++ for Linux
Compiler

Software version: 12.1

Reference #: LI77631

Modified date: 28 October 2013