Fixes are available
October 2009 Update for XL C/C++ for Linux, V10.1
June 2011 Update for XL C/C++ for Linux, V10.1
XL C/C++ for Linux Fix Pack 8 (January 2014 Update) for 10.1
August 2010 Update for XL C/C++ for Linux, V10.1
January 2011 Update for XL C/C++ for Linux, V10.1
January 2012 Update for XL C/C++ for Linux, V10.1
July 2012 Update for XL C/C++ for Linux, V10.1
APAR status
Closed as program error.
Error description
The following test case picks up the incorrect template instantiation resulting in an incorrect output at runtime. ===== COMPILE COMMAND: xlC_r ntest.cpp ===== TESTCASE: $cat ntest.cpp #include <iostream> template <class FUNC> struct hasEllipsis { enum {VALUE = 0}; }; template <class RET> struct hasEllipsis<RET (*)(...)> { enum {VALUE = 1}; }; template <class RET, class A1> struct hasEllipsis<RET (*)(A1,...)> { enum {VALUE = 2}; }; template <class RET, class A1, class A2> struct hasEllipsis<RET (*)(A1,A2,...)> { enum {VALUE = 3}; }; template <class RET, class A1, class A2, class A3> struct hasEllipsis<RET (*)(A1,A2,A3,...)> { enum {VALUE = 4}; }; void foo(int a) { std::cout << "foo" << std::endl; } void bar(int a, ...) { std::cout << "bar" << std::endl; } template<class FUNC> void check(FUNC f) { std::cout << "\tcheck: " << hasEllipsis<FUNC>::VALUE << std::endl; } int main() { std::cout << "foo: should print 0" << std::endl; // Should print 0 since the signature of 'foo' doesn't have an ellipsis. check(&foo); // prints '2' instead std::cout << "bar: should print 2" << std::endl; // Should print 2 since the signature of 'bar' does have an ellipsis. check(&bar); // correctly prints '2'. return 0; } ===== ACTUAL OUTPUT: $ ./a.out foo: should print 0 check: 2 bar: should print 2 check: 2 $ ===== EXPECTED OUTPUT: $ ./a.out foo: should print 0 check: 0 bar: should print 2 check: 2 $
Local fix
n/a
Problem summary
This problem happens when there is a partial specialization based on a function type where 1 parameter is an ellipsis The compiler was allowing the specialization to match a function with no ellipsis and picking an incorrect partial specialization
Problem conclusion
A problem in argument deduction was fixed to allow proper partial specialization matching with ellipsis in function type.
Temporary fix
Comments
APAR Information
APAR number
LI75138
Reported component name
XL C/C++ SLES10
Reported component ID
5724U8300
Reported release
A10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2009-12-01
Closed date
2009-12-01
Last modified date
2009-12-01
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++ SLES10
Fixed component ID
5724U8300
Applicable component levels
RA10 PSN IZ55763
UP06/09/13
[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SSJT9L","label":"XL C\/C++"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"A.1","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]
Document Information
Modified date:
14 October 2021