APAR status
Closed as program error.
Error description
Two function methods in the same class have the same name, 'get', but different signatures. A child class tries to access one of them and uses a 'using' statement, but the compiler issues an error: $ xlC -c apar.cpp "apar.cpp", line 33.12: 1540-0602 (S) The reference to "my_namespace::MyClass::get<int>(const char *) const" is ambiguous because "my_namespace::MyClass::get<int>(const char *) const" can be accessed via multiple paths to base class "my_namespace::MyClass". $ === TEST CASE === namespace my_namespace { class MyClass { public: virtual ~MyClass(); virtual int id() const = 0; template<typename T> T get(const char *parm1) const; virtual void get(const char *parm1, int* parm2) const; }; template<typename T> T MyClass::get(const char *parm1) const { T val; get(parm1, &val); return val; } } class MyClass : public my_namespace::MyClass { public: virtual int num() const ; using my_namespace::MyClass::get; }; int MyClass::num() const { return get<int>("TEST"); }
Local fix
Rename duplicate function method names
Problem summary
PROBLEM DESCRIPTION: During processing of the derived class, the 'using' declaration is unwound to the function template get() in the base class. The unwound declaration is then added to the function candidate list and becomes the overload resolution winner. When the compiler later performs error diagnostic tests, the invalid error is output because the compiler falsely assumes the enclosing class of the winner would be the derived class, while in actuality it is the base class. USERS AFFECTED: This problem affects code that has 'using' declarations in a derived class that introduces function templates in the related base class.
Problem conclusion
The compiler has been fixed to handle the above scenario.
Temporary fix
Comments
APAR Information
APAR number
IJ27833
Reported component name
XL C/C++ FOR AI
Reported component ID
5725C7200
Reported release
G10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2020-09-14
Closed date
2021-05-17
Last modified date
2021-05-17
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
[{"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":"G10"}]
Document Information
Modified date:
18 May 2021