A fix is available
APAR status
Closed as program error.
Error description
The compiler generates an incorrect error message as shown below for the provided test case: ===== COMPILE COMMAND: xlC_r -q32 -qthreaded -qalias=ansi -qlanglvl=extended0x -qsuppress=1540-0198 -c test.cpp ===== TESTCASE: $ cat test.cpp namespace template_test { class FactoryBase { public: int value() const; }; class ReaderFactory : public FactoryBase { }; class WriterFactory : public FactoryBase { }; class DescriptionBase { public: virtual ?DescriptionBase() { } virtual ReaderFactory getRFactory() const = 0; virtual WriterFactory getWFactory() const = 0; }; template<class FactoryType> struct DescriptionFactory { static FactoryType getFactory(DescriptionBase *); }; template<> struct DescriptionFactory<ReaderFactory> { static ReaderFactory getFactory(DescriptionBase * _ptr) { return _ptr->getRFactory(); } }; template<> struct DescriptionFactory<WriterFactory> { static WriterFactory getFactory(DescriptionBase * _ptr) { return _ptr->getWFactory(); } }; class TemplateClass { public: template<typename Factory> int templateFunction(const DescriptionBase *); }; } template<typename Factory> int template_test::TemplateClass::templateFunction(const DescriptionBase * seriesList) { Factory factory = DescriptionFactory<Factory>::getFactory(seriesList); return factory.value(); } class NormalClass { protected: template_test::TemplateClass m_repositories; public: template<typename Factory> int templateFunction(const template_test::DescriptionBase * list) { return m_repositories.templateFunction<Factory>(list); } }; $ ===== ACTUAL OUTPUT: // xlC_r -q32 -qthreaded -qalias=ansi -qlanglvl=extended0x -qsuppress=1540-0198 -c test.cpp // // Result: // "test.cpp", line 66.23: 1540-0204 (S) An expression of type "int" must not be followed by the function call operator (). // "test.cpp", line 64.1: 1540-0700 (I) The previous message was produced while processing "template_test::TemplateClass::templateFunction<Factory>(const DescriptionBase *)". // "test.cpp", line 80.30: 1540-0700 (I) The previous message was produced while processing "template <class Factory> NormalClass::templateFunction(const DescriptionBase *)". ===== EXPECTED OUTPUT: Should compile clean
Local fix
N/A
Problem summary
USERS AFFECTED: Users who use -qlanglvl=extended0x or -qtmplparse=error may be affected by this issue. PROBLEM DESCRIPTION: Template type checking enabled by -qlanglvl=extended0x or -qtmplparse=error was attempting to do too much processing causing an invalid error.
Problem conclusion
The compiler has been fixed to handle the above scenario.
Temporary fix
Comments
APAR Information
APAR number
LI78464
Reported component name
XL C/C++ FOR LI
Reported component ID
5725C7300
Reported release
D10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2015-02-25
Closed date
2015-02-25
Last modified date
2015-02-25
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
5725C7300
Applicable component levels
RD10 PSN IV64515
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":"13.1","Line of Business":{"code":"LOB57","label":"Power"}}]
Document Information
Modified date:
17 October 2021