Fixes are available
January 2009 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
April 2009 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
July 2009 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
November 2010 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
March 2011 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
July 2011 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
December 2011 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
March 2012 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
January 2010 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
May 2010 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
August 2010 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
September 2008 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
APAR status
Closed as program error.
Error description
When compiling the following test case, the result of the sizeof operator inside the template class is incorrect. ------------------------------------- To Compile: xlC test.C ============ TEST CASE ============ extern "C" int printf(const char * , ...); template <class type> struct tempfoo { enum { SIZE = sizeof(type) }; }; struct foo { struct Values { double V1,V2,V3,V4; }; typedef tempfoo<Values> Some_type; Some_type Null_T; typedef tempfoo<Values> Some_type2; struct Values2 { Some_type2 Var_name; }; }; int main() { printf("SIZE = %d, should be %d\n", foo::Some_type2::SIZE, sizeof(foo::Values)); return 1; }
Local fix
Problem summary
USER AFFECTED: Users creating classes with multiple templated variables, of the same type, that get instantiated more than once in a class (ie, the template class uses a template parameter to calculate sizeof). PROBLEM DESCRIPTION: Compiler incorrectly returns information about the template parameter which is not yet fully instantiated (ie, sizeof will return nonsense rather than the actual size).
Problem conclusion
Fixed how templates are instantiated so that this scenario is considered, and correct program output is observed.
Temporary fix
Comments
APAR Information
APAR number
IZ29604
Reported component name
XLC C++ AIX
Reported component ID
5724S7100
Reported release
900
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2008-08-12
Closed date
2008-08-15
Last modified date
2008-09-17
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++ AIX
Fixed component ID
5724S7100
Applicable component levels
Document Information
Modified date:
03 October 2021