Fixes are available
November 2009 PTF for XL C/C++ for AIX, V10.1
October 2010 PTF for XL C/C++ for AIX, V10.1
May 2012 PTF for XL C/C++ for AIX, V10.1
January 2013 PTF for XL C/C++ for AIX, V10.1
XL C/C++ for AIX Fix Pack 18 (July 2013 PTF) for 10.1
XL C/C++ for AIX Fix Pack 19 (October 2013 PTF) for 10.1
XL C/C++ for AIX Fix Pack 21 (October 2015 PTF) for 10.1
August 2009 PTF for XL C/C++ for AIX, V10.1
March 2010 PTF for XL C/C++ for AIX, V10.1
April 2010 PTF for XL C/C++ for AIX, V10.1
June 2010 PTF for XL C/C++ for AIX, V10.1
May 2011 PTF for XL C/C++ for AIX, V10.1
October 2011 PTF for XL C/C++ for AIX, V10.1
February 2012 PTF for XL C/C++ for AIX, V10.1
September 2012 PTF for XL C/C++ for AIX, V10.1
May 2009 PTF for XL C/C++ for AIX, V10.1
XL C/C++ for AIX Fix Pack 20 (October 2014 PTF) for 10.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
IZ51696
Reported component name
XL C++ AIX
Reported component ID
5724U8100
Reported release
A10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2009-05-21
Closed date
2009-05-21
Last modified date
2009-06-03
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++ AIX
Fixed component ID
5724U8100
Applicable component levels
Document Information
Modified date:
04 October 2021