Fixes are available
XL C/C++ for AIX Fix Pack 3 (April 2015 PTF) for 13.1
XL C/C++ for AIX Fix Pack 4 (July 2015 PTF) for 13.1
XL C/C++ for AIX Fix Pack 5 (November 2015 PTF) for 13.1
XL C/C++ for AIX Fix Pack 6 (February 2016 PTF) for 13.1
XL C/C++ for AIX Fix Pack 7 (May 2016 PTF) for 13.1
XL C/C++ for AIX Fix Pack 8 (August 2016 PTF) for 13.1
XL C/C++ for AIX Fix Pack 9 (June 2017 PTF) for 13.1
XL C/C++ for AIX Fix Pack 10 (February 2018 PTF) for 13.1
XL C/C++ for AIX Fix Pack 11 (November 2018 PTF) for 13.1
APAR status
Closed as program error.
Error description
Incorrect template function matching behaviour is seen when an argument accesses a const member of a class. In some cases, an incorrect function could be called, or an internal compiler error may be seen. The root issue is due to the const-status of the access, following the C++03 standard. When a static const member is being accessed by a non-static object in the form 'objname.memname', the const-status of the access becomes non-const. This occurs because the C++ const property is shallow, so the access inherits the const-status of 'objname'. An error message will be output. However, an access of the form 'objname::memname' accessing the same static const member will have type static const. This behaviour was not fully defined in C++03, but was clairified in C++11, which allows both accesses to be const. In C++11, public static const member being accessed using :: or . has the same behavior, whereas in C++03, accessing a value using :: uses the const-status of the static member, but accessing using . will be affected by the object's const-status due to the shallow property. This release follows the C++03 behaviour. === TEST CASE === extern "C" int printf(const char *, ...); template <int N> struct Q; template <typename T> void foo(T *, Q<(*T::bp).value> * = 0) { printf("BAD\n"); } void foo(void *) { printf("GOOD\n"); } struct B { static const int value = 5; }; struct A { static B *bp; }; int main(void) { A *ap = 0; foo(ap); } $ xlC test.cpp $ ./a.out BAD $
Local fix
Problem summary
See above.
Problem conclusion
The behaviour has been corrected to match C++03 behaviour.
Temporary fix
Comments
APAR Information
APAR number
IV68200
Reported component name
XL C/C++ FOR AI
Reported component ID
5725C7200
Reported release
D10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2015-01-05
Closed date
2015-04-29
Last modified date
2015-04-29
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
RD10 PSY
UP
[{"Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSGH3R","label":"XL C\/C++ for AIX"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"13.1"}]
Document Information
Modified date:
03 October 2021