A fix is available
APAR status
Closed as program error.
Error description
The compiler generates an incorrect virtual template error message for the test case mentioned below: $cat test.cpp namespace sc{ template <class T> class Ref {}; } namespace sc { struct DistArray4Dimensions { public: static const DistArray4Dimensions& default_dim() { return default_dim_; } private: static DistArray4Dimensions default_dim_; }; class DistArray4 { public: virtual Ref<DistArray4> clone(const DistArray4Dimensions& dim = DistArray4Dimensions::default_dim()) =0; }; } namespace sc { class DistArray4_MPIIOFile: public DistArray4 { protected: template <typename Derived> Ref<DistArray4> clone(const DistArray4Dimensions& dim = DistArray4Dimensions::default_dim()); }; } $ ===== ACTUAL OUTPUT: $bgxlC -qarch=450d -qtune=450 -c test.cpp "test.cpp", line 34.49: 1540-1158 (S) The function template "sc::DistArray4_MPIIOFile::clone" must not be declared as virtual. $ ===== EXPECTED OUTPUT: Should compile clean.
Local fix
n/a
Problem summary
USERS AFFECTED: Users with member function templates which have the same name and parameter list as a base class virtual function are affected by this issue. PROBLEM DESCRIPTION: A template function which otherwise has the same name and parameter list as a base class virtual function may be incorrectly rejected with a message indicating that the template function may not be declared virtual. struct A { virtual void foo(); }; struct B : A { template <typename T> void foo(); // error message produced for this line }; The function is actually not declared virtual; however, it was mistakenly considered to override the base class virtual function. Specializations of member template functions should never be considered to override members of a base class.
Problem conclusion
A check was implemented to recognize that member function templates never override virtual functions.
Temporary fix
Comments
APAR Information
APAR number
LI77793
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
2014-01-15
Closed date
2014-01-15
Last modified date
2014-01-15
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 LI76710
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