Fixes are available
APAR status
Closed as program error.
Error description
Compile errors and incorrect runtime behaviour is seen when specialized template code uses template dependent expressions as template type arugments. The compiler may evaluate the expression incorrectly, leading to a compile error, or unexpected runtime behaviour. An example may be using a boolean expression as a template argument: ------------------ template <typename TYPE> struct mystruct< TYPE , typename enable_if<not(not(always_true<TYPE>::value))>::type > ------------------ , which may evaluate the boolean 'not' operations incorrectly, giving incorrect behaviour. A more complex compile-error example is given below: ===== TESTCASE: $cat sfinae.cpp #include <iostream> template <bool Condition, typename T = void> struct enable_if; template <typename T> struct enable_if<true,T> { typedef T type; }; template <typename U, typename V> struct is_same { static const bool value = false; }; template <typename U> struct is_same<U,U> { static const bool value = true; }; template <typename N, typename M, typename Enable = void> struct Foo; template <typename N, typename M> struct Foo<N,M, typename enable_if< is_same<N,M>::value >::type> { static void print() { std::cout << "Hello" << std::endl; } }; template <typename N, typename M> struct Foo <N,M, typename enable_if< (!is_same<N,M>::value) >::type> { static void print() { std::cout << "World" << std::endl; } }; int main() { Foo<int,int>::print(); Foo<int,unsigned>::print(); return 0; } ===== ACTUAL OUTPUT: xlC -c sfinae.cpp "sfinae.cpp", line 40.3: 1540-0130 (S) "Foo<int,unsigned int,void>::print" is not declared. ===== EXPECTED OUTPUT: Compiles clean.
Local fix
N/A
Problem summary
PROBLEM DESCRIPTION: Template testcase is failing on XL C++ compiler due to argument deduction error. USERS AFFECTED: Users with template type dependent arguments with boolean expression.
Problem conclusion
Problem has been fixed, and template arguments are now deducted correctly.
Temporary fix
Comments
APAR Information
APAR number
LI78259
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
2014-10-30
Closed date
2014-10-30
Last modified date
2014-10-30
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 LI
Fixed component ID
5725C7300
Applicable component levels
RD10 PSN LI77859
UP06/09/13
[{"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":"13.1","Line of Business":{"code":"LOB57","label":"Power"}}]
Document Information
Modified date:
17 October 2021