Fixes are available
March 2009 Update for XL C/C++ Advanced Edition for Blue Gene/P, V9.0
August 2009 Update for XL C/C++ Advanced Edition for Blue Gene/P, V9.0
May 2010 Update for XL C/C++ Advanced Edition for Blue Gene/P, V9.0
December 2010 Update for XL C/C++ Advanced Edition for Blue Gene/P, V9.0
XL C/C++ Advanced Edition for Blue Gene/P Fix Pack 17 (October 2013 Update) for 9.0
April 2011 Update for XL C/C++ Advanced Edition for Blue Gene/P, V9.0
August 2011 Update for XL C/C++ Advanced Edition for Blue Gene/P, V9.0
April 2012 Update for XL C/C++ Advanced Edition for Blue Gene/P, V9.0
August 2012 Update for XL C/C++ Advanced Edition for Blue Gene/P, V9.0
APAR status
Closed as program error.
Error description
Partial template overload resolution fails to compile with XL C++ v9 on BlueGene/P. ============================================================= Test Case: ============================================================= template<typename T1, typename T2> class Pair { public: T1 first; T2 second; }; struct Nil{}; template<typename T> class Pair<T,Nil> { public: T first; }; template<typename T1, typename T2, typename U1, typename U2> bool operator==(const Pair<T1,T2>& t1, const Pair<U1,U2>& t2) { return t1.first==t2.first && t1.second == t2.second; } template<typename T1, typename U1> bool operator==(const Pair<T1,Nil>& t1, const Pair<U1,Nil>& t2) { return t1.first==t2.first; } template<typename T1, typename T2, typename U1> bool operator==(const Pair<T1,T2>& t1, const Pair<U1,Nil>& t2) { return false; } int main() { Pair<int, Pair<double,Nil> > a; Pair<int, Pair<double,Nil> > b; Pair<const int*, Nil> a1; Pair<const int*, Nil> b1; return a==b && a1==b1; } ===== ACTUAL OUTPUT: "TestCase.cpp", line 45.20: 1540-0219 (S) The call to "operator==" has no best match. "TestCase.cpp", line 45.18: 1540-1228 (I) Argument number 1 is an lvalue of type "Pair<const int *,Nil>". "TestCase.cpp", line 45.22: 1540-1228 (I) Argument number 2 is an lvalue of type "Pair<const int *,Nil>". "TestCase.cpp", line 32.6: 1540-1202 (I) No candidate is better than "operator== <const int *,Nil,const int *>(const Pair<const int *,Nil> &, const Pair<const int *,Nil> &)". "TestCase.cpp", line 45.18: 1540-1231 (I) The conversion from argument number 1 to "const Pair<const int *,Nil> &" uses "the identity conversion". "TestCase.cpp", line 45.22: 1540-1231 (I) The conversion from argument number 2 to "const Pair<const int *,Nil> &" uses "the identity conversion". "TestCase.cpp", line 25.6: 1540-1202 (I) No candidate is better than "operator== <const int *,const int *>(const Pair<const int *,Nil> &, const Pair<const int *,Nil> &)". "TestCase.cpp", line 45.18: 1540-1231 (I) The conversion from argument number 1 to "const Pair<const int *,Nil> &" uses "the identity conversion". "TestCase.cpp", line 45.22: 1540-1231 (I) The conversion from argument number 2 to "const Pair<const int *,Nil> &" uses "the identity conversion". "TestCase.cpp", line 21.42: 1540-0219 (S) The call to "operator==" has no best match. "TestCase.cpp", line 21.34: 1540-1228 (I) Argument number 1 is an lvalue of type "const Pair<double,Nil>". "TestCase.cpp", line 21.47: 1540-1228 (I) Argument number 2 is an lvalue of type "const Pair<double,Nil>". "TestCase.cpp", line 32.6: 1540-1202 (I) No candidate is better than "operator== <double,Nil,double>(const Pair<double,Nil> &, const Pair<double,Nil> &)". "TestCase.cpp", line 21.34: 1540-1231 (I) The conversion from argument number 1 to "const Pair<double,Nil> &" uses "the identity conversion". "TestCase.cpp", line 21.47: 1540-1231 (I) The conversion from argument number 2 to "const Pair<double,Nil> &" uses "the identity conversion". "TestCase.cpp", line 25.6: 1540-1202 (I) No candidate is better than "operator== <double,double>(const Pair<double,Nil> &, const Pair<double,Nil> &)". "TestCase.cpp", line 21.34: 1540-1231 (I) The conversion from argument number 1 to "const Pair<double,Nil> &" uses "the identity conversion". "TestCase.cpp", line 21.47: 1540-1231 (I) The conversion from argument number 2 to "const Pair<double,Nil> &" uses "the identity conversion". "TestCase.cpp", line 19.6: 1540-0700 (I) The previous message was produced while processing "operator== <int,Pair<double,Nil>,int,Pair<double,Nil> >(const Pair<int,Pair<double,Nil> > &, const Pair<int,Pair<double,Nil> > &)". "TestCase.cpp", line 39.5: 1540-0700 (I) The previous message was produced while processing "main()". ===== EXPECTED OUTPUT: Successful compile
Local fix
When commenting out the most specific incriminated function the compile process goes on completion. template<typename T1, typename U1> bool operator==(const Pair<T1,Nil>& t1, const Pair<U1,Nil>& t2) { return t1.first==t2.first; } Though this solution is not always valid, and will sometimes fail.
Problem summary
The problem may appear when a template dependent name references a class with partial specializations. The compiler was attemtping to match partial specializations with a template-dependent name. This is not valid as it may cause errors in name resolution, due to the dependent name.
Problem conclusion
Name lookup no longer attempts to match partial specializations before instantiation
Temporary fix
Comments
APAR Information
APAR number
LI74131
Reported component name
XL C/C++ AE BG/
Reported component ID
5799HJE00
Reported release
900
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2009-01-15
Closed date
2009-01-15
Last modified date
2009-01-15
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++ AE BG/
Fixed component ID
5799HJE00
Applicable component levels
R900 PSY
UP
Document Information
Modified date:
16 October 2021