IBM Support

LI77947: TEMPLATE ARGUMENT DEDUCTION ERROR WITH XLC

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The compiler incorrectly issues an error message for the test
    case below:
    
    ======Compile Command:
    $ xlC -c test.cpp
    
    ===== TESTCASE:
    $ cat test.cpp
    struct F {
        template <int N>
        void foo() { }
        template <int N>
        void foo() const { }
    };
    
    
    template <class T>
    void foo_call(void (T::*func)(), T& o)
    {
        (o.*func)();
    }
    
    
    int main() {
        F o;
        foo_call(&F::foo<10>, o); // Get error here.
    
    
    }
    $
    
    
    
    
    ===== ACTUAL OUTPUT:
    $xlC -c test.cpp
    "test.cpp", line 16.15: 1540-0298 (S) Template argument
    deduction cannot be performed using the function "template void
    foo()".
    $
    
    ===== EXPECTED OUTPUT:
    Clean compile
    

Local fix

  • A workaround is to declare non-template functions.
    

Problem summary

  • USERS AFFECTED:
    Users with specialized template arguments inside of a template
    function are affected by this issue.
    
    PROBLEM DESCRIPTION:
    Template arguments were disallowed in the compiler, resulting
    in an invalid error message.
    

Problem conclusion

  • The compiler no longer rejects specialized template arguments
    incorrectly.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI77947

  • 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

    2014-04-30

  • Closed date

    2014-04-30

  • Last modified date

    2014-04-30

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

    IV54886

  • 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

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

Document Information

Modified date:
16 October 2021