Fixes are available
APAR status
Closed as program error.
Error description
After passing a complex typedef to a function that instantiates a template class, the template class has trouble determining the correct constructor to use. The constructors are identical except for a const on the first parameter: TroubleType(U& u, typename Test<U, T>::type = 0) TroubleType(const U& u, typename Test<U, T>::type = 0) The compiler states that there is no best match. === TEST CASE === template <class T, class U> struct Test { typedef void * type; }; struct A {}; template <int (*)(A *)> struct B {}; template <class T> struct C { static int f(T *) { return 0; } }; template <class FUNC> class Function {}; int result = 12345; template <class T> struct TroubleType { template <class U> TroubleType(U& u, typename Test<U, T>::type = 0) { result = -99; } template <class U> TroubleType(const U& u, typename Test<U, T>::type = 0) { result = 0; } }; typedef Function<void (*)(B<&C<A>::f> *)> F; void l(const F& f) { TroubleType<F> p( f); } int main() { F f; l(f); return result; } $ xlC_r -c apar.cpp "apar.cpp", line 40.20: 1540-0219 (S) The call to "TroubleType<Function<void (*)(B<&C<A>::f> *)> >::TroubleType<Function<void (*)(B<&C<A>::f> *)> >" has no best match. "apar.cpp", line 40.23: 1540-1228 (I) Argument number 1 is an lvalue of type "const Function<void (*)(B<&C<A>::f> *)>". "apar.cpp", line 30.5: 1540-1202 (I) No candidate is better than "TroubleType<Function<void (*)(B<&C<A>::f> *)> >::TroubleType(const Function<void (*)(B<&C<A>::f> *)> &, type)". "apar.cpp", line 40.23: 1540-1231 (I) The conversion from argument number 1 to "const Function<void (*)(B<&C<A>::f> *)> &" uses "the identity conversion". "apar.cpp", line 24.5: 1540-1202 (I) No candidate is better than "TroubleType<Function<void (*)(B<&C<A>::f> *)> >::TroubleType(const Function<void (*)(B<&C<A>::f> *)> &, type)". "apar.cpp", line 40.23: 1540-1231 (I) The conversion from argument number 1 to "const Function<void (*)(B<&C<A>::f> *)> &" uses "the identity conversion". $
Local fix
Remove const version of constructor.
Problem summary
PROBLEM DESCRIPTION: An error during partial ordering caused invalid compiler errors (containing no file/line info) to be emitted. USERS AFFECTED: Users of overloaded function templates.
Problem conclusion
The problem has been resolved.
Temporary fix
Comments
APAR Information
APAR number
IJ04507
Reported component name
XL C/C++ FOR AI
Reported component ID
5725C7200
Reported release
D10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2018-03-02
Closed date
2018-03-02
Last modified date
2018-03-02
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 AI
Fixed component ID
5725C7200
Applicable component levels
RD10 PSY
UP
[{"Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSGH3R","label":"XL C\/C++ for AIX"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"13.1"}]
Document Information
Modified date:
23 September 2021