Fixes are available
October 2009 Update for XL C/C++ for Linux, V10.1
June 2011 Update for XL C/C++ for Linux, V10.1
XL C/C++ for Linux Fix Pack 8 (January 2014 Update) for 10.1
August 2010 Update for XL C/C++ for Linux, V10.1
January 2011 Update for XL C/C++ for Linux, V10.1
January 2012 Update for XL C/C++ for Linux, V10.1
July 2012 Update for XL C/C++ for Linux, V10.1
APAR status
Closed as program error.
Error description
The compiler may incorrectly issue an error message for some template code defined between a function declaration and the function definition where it is used. e.g.: $ cat tc.cxx struct A { static char foo(); char bar(char c = foo()); }; struct B { B(int i) : t(i) {} int t; }; template <class T> struct D : public B { D() : B(0) {} }; char A::foo() { D<int> di; return 'a'; } $ xlC -c tc.cxx "tc.cxx", line 17.7: 1540-0253 (S) This use of undefined class "B" is not valid. "tc.cxx", line 17.3: 1540-0700 (I) The previous message was produced while processing "D<int>::D()". "tc.cxx", line 22.10: 1540-0700 (I) The previous message was produced while processing "A::foo()". $
Local fix
Move the template code ahead of the function declaration.
Problem summary
A name lookup error may happen in the body of a template function where the required name is defined between the function declaration and the function definition. This happens for some source because the compiler incorrectly takes the location of the forward declaration to be the point of instantiation instead of location of function definition. If this problem occurs, the compiler will emit a name lookup error indicating an invalid us of an undefined class.
Problem conclusion
The compiler now handles this scenario correctly, and the invalid message is not emitted.
Temporary fix
Comments
APAR Information
APAR number
LI74353
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
2009-03-31
Closed date
2009-03-31
Last modified date
2009-03-31
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 IZ44565
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:
17 October 2021