IBM Support

LI78471: 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

    LI78471

  • Reported component name

    XL C/C++ FOR LI

  • Reported component ID

    5725C7300

  • Reported release

    D10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2015-02-25

  • Closed date

    2015-02-25

  • Last modified date

    2015-02-25

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

    IV67337

  • 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

  • RD10 PSY

       UP



Document information

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

Software version: 13.1

Reference #: LI78471

Modified date: 25 February 2015