IBM Support

IV67337: COMPILE TIME ERROR RELATED TO INITIALIZATION AND LVALUE CONVERSION

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The compiler issues an error message for the following test
    case:
    
    ===== COMPILE COMMAND:
    xlC_r -q32 -qthreaded -qalias=ansi -qlanglvl=extended0x -c
    test.cpp
    
    ===== TESTCASE:
    $ cat test.cpp
    template<typename TFrom, typename TTo = TFrom>
    TTo
    templateFunction(TFrom from)
    {
    return static_cast<TTo>(from);
    }
    
    int main()
    {
    long long value = templateFunction<long long>(55);
    return (value == 55);
    }
    $
    
    
    ===== ACTUAL OUTPUT:
    $
    /gsa/tlbgsa/projects/x/xlcmpbld/run/vacpp/121_com/aix/daily/late
    st/bin/xlC_r -q32 -qthreaded -qalias=ansi -qlanglvl=extended0x
    -c test.cpp
    "test.cpp", line 10.46: 1540-2465 (S) An object or reference of
    type "long long" cannot be initialized with a prvalue of type
    "TFrom".
    "test.cpp", line 5.25: 1540-2463 (S) An lvalue expression of
    type "long long" cannot be converted to type "TFrom".
    "test.cpp", line 5.25: 1540-0218 (I) The call does not match any
    parameter list for "TFrom::TFrom".
    "test.cpp", line 1.10: 1540-1283 (I) "implicit
    TFrom::TFrom(const TFrom &)" is not a viable candidate.
    "test.cpp", line 5.25: 1540-2463 (I) An lvalue expression of
    type "long long" cannot be converted to type "const TFrom &".
    "test.cpp", line 3.1: 1540-0700 (I) The previous message was
    produced while processing "templateFunction<long
    long,TFrom>(long long)".
    "test.cpp", line 8.5: 1540-0700 (I) The previous message was
    produced while processing "main()".
    $
    
    
    ===== EXPECTED OUTPUT:
    Clean compile.
    

Local fix

  • N/A
    

Problem summary

  • USERS AFFECTED:
    Users how have initialization and lvalue conversions in their
    code may be affected by this issue.
    
    PROBLEM DESCRIPTION:
    The compiler results in a missing template argument
    substitution on default template argument for function
    templates; causig a compile time error.
    

Problem conclusion

  • The compiler has been fixed to allow function template default
    arguments to also contain template parameters.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IV67337

  • Reported component name

    XL C/C++ FOR AI

  • Reported component ID

    5725C7200

  • Reported release

    C10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2014-11-28

  • Closed date

    2015-02-26

  • Last modified date

    2015-02-26

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

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

    LI78471 IV72799

Fix information

  • Fixed component name

    XL C/C++ FOR AI

  • Fixed component ID

    5725C7200

Applicable component levels

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSGH3R","label":"XL C\/C++ for AIX"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"12.1","Edition":"","Line of Business":{"code":"LOB73","label":"Power TPS"}}]

Document Information

Modified date:
19 August 2024