Fixes are available
XL C/C++ for Linux Fix Pack 8 (October 2015 Update) for 12.1
XL C/C++ for Linux Fix Pack 4 (October 2013 Update) for 12.1
XL C/C++ for Linux Fix Pack 5 (December 2013 Update) for 12.1
XL C/C++ for Linux Fix Pack 6 (February 2014 Update) for 12.1
XL C/C++ for Linux Fix Pack 7 (May 2014 Update) for 12.1
APAR status
Closed as program error.
Error description
===== DESCRIPTION: The compiler is mistakenly generating an error related to "use before defined" for templates when it shouldn't. ===== Compile command: xlC -c test.cpp ========Testcase: $ cat test.cpp #include <iostream> #include <vector> namespace LibGeoDecomp { template<int DIM> class Coord { public: Coord(int x, int y) { pos[0] = x; pos[1] = y; } int pos[DIM]; }; class Stencils { public: template<int DIM, int RADIUS> class Moore { static const int dim = DIM; static const int radius = RADIUS; }; }; class TopologiesHelpers { public: template<int DIM, bool WRAP_X=false, bool WRAP_Y=false, bool WRAP_Z=false> class Topology { public: static const int dim = DIM; static const int wrapX = WRAP_X; static const int wrapY = WRAP_Y; static const int wrapZ = WRAP_Z; }; }; template<int DIM=2, typename STENCIL=Stencils::Moore<2, 1>, typename TOPOLOGY=TopologiesHelpers::Topology<2, 0, 0, 0> > class TestCell { public: typedef STENCIL Stencil; typedef TOPOLOGY Topology; static const int dim = DIM; }; template<typename CELL, typename TOPOLOGY=TopologiesHelpers::Topology<2, 0, 0, 0> > class Grid { public: typedef CELL Cell; typedef TOPOLOGY Topology; static const int DIM = CELL::Topology::dim; Grid(Coord<DIM> c) : dim(c) { std::cout << "Grid(" << c.pos[0] << ", " << c.pos[1] << ")\n"; }; Coord<DIM> getDimensions() { return dim; } private: Coord<DIM> dim; }; template<typename CELL_TYPE> class Simulator { public: typedef typename CELL_TYPE::Topology Topology; typedef Grid<CELL_TYPE, Topology> GridType; virtual void step() = 0; virtual void run() = 0; }; template<typename CELL_TYPE> class MonolithicSimulator : public Simulator<CELL_TYPE> { public: inline MonolithicSimulator() : Simulator<CELL_TYPE>() {} virtual const typename Simulator<CELL_TYPE>::GridType *getGrid() = 0; }; class MockSimulator : public MonolithicSimulator<TestCell<2> > { public: typedef TestCell<2> MyTestCell; typedef Grid<MyTestCell> MyType; MockSimulator() : MonolithicSimulator<TestCell<2> >() {} void step() {} void run() {} MyType *getGrid() { return 0; } }; // enable this code to make the error go away: // typedef LibGeoDecomp::Grid<LibGeoDecomp::TestCell<2,LibGeoDecomp::Stenci ls::Moore<2,1>,LibGeoDecomp::TopologiesHelpers::Topology<2,0,0,0 > >,LibGeoDecomp::TopologiesHelpers::Topology<2,0,0,0> > TestGrid; // TestGrid dummy(LibGeoDecomp::Coord<2>(10, 20)); } int main() { LibGeoDecomp::MockSimulator a; std::cout << sizeof(a) << "\n"; return 0; } ===== ACTUAL OUTPUT: $ /gsa/tlbgsa/projects/x/xlcmpbld/run/vacpp/121_com/bgq/daily/late st/bin/xlC -c test.cpp $ "test.cpp", line 54.7: 1540-0253 (S) This use of undefined class "LibGeoDecomp::Grid<LibGeoDecomp::TestCell<2,LibGeoDecomp::Stenc ils::Moore<2,1>,LibGeoDecomp::TopologiesHelpers::Topology<2,0,0, 0> >,LibGeoDecomp::TopologiesHelpers::Topology<2,0,0,0> >" is not valid. ===== EXPECTED OUTPUT: Should compile clean.
Local fix
Explicitly declare the template function as follows: typedef LibGeoDecomp::Grid<LibGeoDecomp::TestCell<2,LibGeoDecomp::Stenci ls::Moore<2,1>,LibGeoDecomp::TopologiesHelpers::Topology<2,0,0,0 > >,LibGeoDecomp::TopologiesHelpers::Topology<2,0,0,0> > TestGrid; TestGrid dummy(LibGeoDecomp::Coord<2>(10, 20));
Problem summary
USERS AFFECTED: User code with virtual function's return type declared as the combination of template and typedefs are affected by this issue. PROBLEM DESCRIPTION: The compiler mistakenly treats the two virtual functions as functions with covariant return types, and object model fails to find the information of handling covariant return functions.
Problem conclusion
Modified the object model code to recognize the virtual function's return types are the same instead of treating them as covariant return functions.
Temporary fix
Comments
APAR Information
APAR number
LI77573
Reported component name
XL C/C++ FOR LI
Reported component ID
5725C7300
Reported release
C10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2013-10-28
Closed date
2013-10-28
Last modified date
2013-10-28
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++ FOR LI
Fixed component ID
5725C7300
Applicable component levels
RC10 PSN LI77348
UP06/09/13
[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSXVZZ","label":"XL C\/C++ for Linux"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"12.1","Line of Business":{"code":"LOB57","label":"Power"}}]
Document Information
Modified date:
13 October 2021