A fix is available
APAR status
Closed as program error.
Error description
Compiling the following test case TemplateBug.cpp with xlC emits error: "TemplateBug.cpp", line 19.1: 1540-1174 (S) The member "template const Bar<T,0,1> &Bang(const Bar &)" is not declared as a template in its containing class definition. ===== TESTCASE: > cat TemplateBug.cpp enum Foo { Alpha, Beta }; template<typename T, Foo F, Foo G> class Bar; // Partial specialization of Bar template<typename T> class Bar<T,Alpha,Beta> { public: const Bar<T,Alpha,Beta>& Bang( const Bar<T,Alpha,Beta>& bar ); }; // Implementation of member function of partially specialized Bar template<typename T> const Bar<T,Alpha,Beta>& Bar<T,Alpha,Beta>::Bang ( const Bar<T,Alpha,Beta>& bar ) { return bar; } // Explicit instantiation template class Bar<double,Alpha,Beta>;
Local fix
Changing const Bar<T,Alpha,Beta>& to void makes it pass. for example: >cat TemplateNoBug.cpp enum Foo { Alpha, Beta }; template<typename T, Foo F, Foo G> class Bar; // Partial specialization of Bar template<typename T> class Bar<T,Alpha,Beta> { public: void Bang( const Bar<T,Alpha,Beta>& bar ); }; // Implementation of member function of partially specialized Bar template<typename T> void Bar<T,Alpha,Beta>::Bang ( const Bar<T,Alpha,Beta>& bar ) { } // Explicit instantiation template class Bar<double,Alpha,Beta>;
Problem summary
PROBLEM DESCRIPTION: The compiler is failing to match the out-of-line definition of a template member with a non-type parameter which is an enumeration. USERS AFFECTED: The problem affects users of template classes with non-type parameters of enumeration type.
Problem conclusion
The compiler was incorrectly matching the out-of-line member when a non-type template parameter was an enumeration type. The problem is fixed now.
Temporary fix
Comments
APAR Information
APAR number
LI75976
Reported component name
XL C/C++ RHEL5
Reported component ID
5724S7310
Reported release
900
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2011-02-23
Closed date
2011-02-23
Last modified date
2011-02-23
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++ RHEL5
Fixed component ID
5724S7310
Applicable component levels
R900 PSN LI75501
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":"9.0","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]
Document Information
Modified date:
15 October 2021