Fixes are available
XL C/C++ for AIX Fix Pack 11 (February 2015 PTF) for 12.1
XL C/C++ for AIX Fix Pack 12 (May 2015 PTF) for 12.1
XL C/C++ for AIX Fix Pack 13 (August 2015 Update) for 12.1
XL C/C++ for AIX Fix Pack 14 (December 2015 Update) for 12.1
XL C/C++ for AIX Fix Pack 15 (April 2016 Update) for 12.1
XL C/C++ for AIX Fix Pack 16 (July 2016 Update) for 12.1
XL C/C++ for AIX Fix Pack 17 (November 2016 Update) for 12.1
XL C/C++ for AIX Fix Pack 18 (February 2017 Update) for 12.1
XL C/C++ for AIX Fix Pack 19 (August 2017 Update) for 12.1
XL C/C++ for AIX Fix Pack 20 (March 2018 Update) for 12.1
XL C/C++ for AIX Fix Pack 10 (October 2014 PTF) for 12.1
XL C/C++ for AIX Fix Pack 21 (January 2019 Update) for 12.1
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
IV61653
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
Submitted date
2014-06-17
Closed date
2014-10-23
Last modified date
2014-10-23
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
Document Information
Modified date:
01 October 2021