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
XL C/C++ for AIX Fix Pack 20 (October 2014 PTF) for 10.1
APAR status
Closed as program error.
Error description
A class template takes a class type as it's first parameter, and an int as it's second parameter. The int's default value is dependant on the class type of the first parameter (in the following testcase the sizeof function is used). When instantiating the class template with a class type that is defined lower in the source, the compiler reports that the class is undefined. ===== Error ===== "test.C", line 1.31: 1540-1109 (S) The use of undefined class "SomeClass" is not valid. ===== TESTCASE ===== template <class T, int myInt = sizeof(T)> class TestClass {}; class SomeClass {}; int main() { TestClass<SomeClass> test; }
Local fix
A forward definition of the class does not solve the issue. Moving the full class above the template class solves the problem.
Problem summary
USER AFFECTED: The problem may appear when a sizeof expression is used in a default template parameter, and that sizeof expression depends on the previous template parameters. PROBLEM DESCRIPTION: The compiler was resolving the name at the wrong location.
Problem conclusion
The compiler now uses the correct location to resolve the name.
Temporary fix
Comments
APAR Information
APAR number
IZ50126
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-04-24
Closed date
2009-07-31
Last modified date
2009-08-27
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