IBM Support

IJ31048: TYPEDEF'ED STRUCT NOT MATCHING TEMPLATE SPECIALIZATION USING POINTER-TO-CLASS-MEMBER TYPE

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

 

APAR status

  • Closed as program error.

Error description

  • A specialization uses a pointer-to-class-data-member ::* type
    for another class template instantiation (struct V).  The
    specialization is matched correctly when the class is a normally
    defined 'struct A', but fails when the class is a typedef'ed
    'typedef struct {...} B'.
    
    
       === TEST CASE ===
    
    extern "C" int printf(const char *, ...);
    
    template <class T>
    struct V
    {
      typedef void y;
    };
    
    //--------------------------------------------
    
    template <class Y, class = void>
    struct I
    {
      enum { v = 1 }; // B is incorrectly instantiating this
    };
    
    template <class Y>
    struct I<Y, typename V<int Y::*>::y>
    {
      enum { v = 0 };   // Both A and B should instantiate this
    };
    
    //--------------------------------------------
    
    struct X { X() {} };
    
    struct A { X x; };
    typedef struct { X x; } B;
    
    int main()
    {
        printf("A %d\n", I<A>::v);
        printf("B %d\n", I<B>::v); // Bad output, 1, should be 0
    }
    

Local fix

  • Do not use typedef
    

Problem summary

  • USERS AFFECTED:
    Users who have testcases that make use of template
    specializations may run into this issue.
    
    PROBLEM DESCRIPTION:
    The specialization uses a pointer-to-class-data-member ::* type
    for another class template instantiation (struct V).
    The specialization is matched correctly when the class is a
    normally defined 'struct A', but fails when the class is a
    typedef'ed 'typedef struct {...} B'.
    

Problem conclusion

  • The compiler has been fixed to handle the above mentioned
    scenario.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IJ31048

  • Reported component name

    XL C/C++ FOR AI

  • Reported component ID

    5725C7200

  • Reported release

    G10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2021-02-26

  • Closed date

    2021-05-28

  • Last modified date

    2021-05-28

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

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

Fix information

  • Fixed component name

    XL C/C++ FOR AI

  • Fixed component ID

    5725C7200

Applicable component levels

[{"Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSGH3R","label":"XL C\/C++ for AIX"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"G10"}]

Document Information

Modified date:
29 May 2021