Fixes are available
APAR status
Closed as program error.
Error description
Consider the following test.cpp: ///////////// test.cpp ////////////////////// struct A { int bar() { return 0; } int bar() const { return 1; } }; template<typename T> void foo(T A::*) { } // (1) template<typename T> void foo(T (A::*)() const) { } // (2) int main() { foo(&A::bar); } // should expand via (2) above // XL C/C++ compiler cannot decide between (1) & (2) //////////////end of test.cpp /////////////// $xlC test.cpp "test.cpp", line 7.14: 1540-0219 (S) The call to "foo" has no best match. "test.cpp", line 7.18: 1540-1229 (I) Argument number 1 is an rvalue of type "overloaded function: A::bar". "test.cpp", line 6.27: 1540-1202 (I) No candidate is better than "foo<int>(int (A::*)() const)". "test.cpp", line 7.18: 1540-1231 (I) The conversion from argument number 1 to "int (A::*)() const" uses the resolved overloaded function "int A::bar() const". "test.cpp", line 5.27: 1540-1202 (I) No candidate is better than "foo<int ()>(int (A::*)())". "test.cpp", line 7.18: 1540-1231 (I) The conversion from argument number 1 to "int (A::*)()" uses the resolved overloaded function "int A::bar()".
Local fix
N/A
Problem summary
When applying template argument deduction with a type A that is a pointer to non-static member function type, the corresponding type P must match the cv-qualifier-seq of the type A exactly when using XL C/C++ for deduction to succeed. This may cause deduction to succeed where it would otherwise fail when the type of A is the address of a member function overloaded on the cv-qualifier-seq.
Problem conclusion
Fix is enabled with -qxflag=FunctionCVTmplArgDeduction2011 which also sets macro __IBMCPP_FUNC_CV_TMPL_ARG_DEDUCTION to 1. The new behaviour may become the default in a future release. Handling of cv-qualifier-seq in function types and cv-qualification is modified in template argument deduction.
Temporary fix
Comments
APAR Information
APAR number
LI76650
Reported component name
XL C/C++ FOR LI
Reported component ID
5724X1400
Reported release
B10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2012-02-06
Closed date
2012-02-06
Last modified date
2012-02-06
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
5724X1400
Applicable component levels
RB10 PSN IV11365
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":"B10","Line of Business":{"code":"LOB57","label":"Power"}}]
Document Information
Modified date:
17 October 2021