Fixes are available
APAR status
Closed as program error.
Error description
Compiler is incorrectly resolving the names in the default argument at the point of the definition of that default argument, when it should be resolved at the point of instantiation since the default argument is template-dependent. TESTCASE: -------- template<class T> class Traits; class XXX {}; template<> struct Traits<XXX> { enum {classRevision = 0}; }; template <class T1, class T2, int I = (int)Traits<T2>::classRevision> struct A { }; template <int I, class T2> struct A<short, T2, I> { }; class YYY{}; template<> struct Traits<YYY>{ enum {classRevision = 1}; }; A<double, XXX> x1; A<short, XXX> x2; A<double, YYY> x3; A<short, YYY> x4; ACTUAL OUTPUT: ------------- "t10.cpp", line 10.44: 1540-1109 (S) The use of undefined class "Traits<YYY>" is not valid. "t10.cpp", line 10.44: 1540-1109 (S) The use of undefined class "Traits<YYY>" is not valid.
Local fix
ove the class referenced in the message so that it is before the default argument causing the message.
Problem summary
USER AFFECTED: Users of template-dependent default template arguments. PROBLEM DESCRIPTION: We were incorrectly resolving the names in the default argument at the point of the definition of that default argument, when it should be resolved at the point of instantiation since the default argument is template-dependent. EXPECTED ERROR: User would see an error indicating an invalid use of an undefined or incomplete class at the point of definition finition of the invalid default argument.
Problem conclusion
We now correctly resolve names in dependent template parameters at the point of instantiation.
Temporary fix
Comments
APAR Information
APAR number
LI71448
Reported component name
XLC/C++ SLES9
Reported component ID
5724M1600
Reported release
800
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2006-09-12
Closed date
2006-09-12
Last modified date
2006-09-12
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
XLC/C++ SLES9
Fixed component ID
5724M1600
Applicable component levels
R800 PSN
UP
[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SSJT9L","label":"XL C\/C++"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"8.0","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]
Document Information
Modified date:
15 October 2021