IBM Support

IZ95621: TEMPLATE ASSIGNMENT OPERATOR CALLS ITSELF

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • template assignment operator calls itself recursively in the
    example below leading to segfault at runtime.
    
    
    ///////////////////// test.cpp //////////////////////
    
    template<typename First> struct Base
    {
      template<typename OtherFirst>
      First& operator=(const Base<OtherFirst>& other) { }
    
    inline First& operator=(const Base& other) {
       return operator=<First>(other); }
    };
    
    int main()
    {
     Base<int> a;
     a = Base<int>();
     return 0;
    }
    
    ////////////////// end of test.cpp //////////////////////
    
    $xlC test.cpp
    $./a.out
    Segmentation fault (core dumped)
    

Local fix

  • N/A
    

Problem summary

  • Assignment operator call with explicit template args may invoke
    incorrect function
    

Problem conclusion

  • The problem is isolated to the FE and a fix has been dropped.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IZ95621

  • Reported component name

    XLC C++ AIX

  • Reported component ID

    5724S7100

  • Reported release

    900

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2011-02-23

  • Closed date

    2011-02-23

  • Last modified date

    2011-02-23

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

    LI75770

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

Fix information

  • Fixed component name

    XLC C++ AIX

  • Fixed component ID

    5724S7100

Applicable component levels

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

Document Information

Modified date:
05 October 2021