|
Boost : |
From: Boris Gubenko (Boris.Gubenko_at_[hidden])
Date: 2007-01-10 20:32:34
With aCC6 on HP-UX, python library test data_members.cpp fails to compile
with "more than one instance of overloaded function matches the argument
list" error. x.cpp below is a reduced reproducer derived from
data_members.cpp.
The reason it fails to compile is that by default, aCC6 disables standard-
compliant dependent template name lookup implemented by EDG in Version
2.44. The program does compile, with both aCC6 and "bare" EDG Front End
Version 3.5, in strict ansi mode where "the 2-phase lookup of template
names is performed as required by the standard" or when standard lookup
is explicitly requested via -dep_name option -- see below. Other EDG-based
compilers exhibit similar behaviour, in particular, Comeau C/C++ 4.3.8
and Intel's icc 9.0.
Attached aCC6-specific patch for data_members.hpp disambigues function
call in question by casting the argument, similar to the cast under the
WORKAROUND macro in x.cpp below.
With the attached patch, test data_members passes on HP-UX. I also
verified, that the patch does not cause any regressions. Please apply it
to CVS HEAD and the RC branch.
Thanks,
Boris
x.cpp
-----
namespace detail
{
struct not_specified {};
template <class D, class Policies>
void make_getter(D* d, Policies const& policies, int);
template <class D>
void make_getter(D* d, not_specified policy, long)
{
#ifdef WORKAROUND
detail::make_getter(d, static_cast<not_specified const&>(policy), 0);
#else
detail::make_getter(d, policy, 0);
#endif
}
template <class D, class P>
void make_getter(D& d, P& p, ...);
} // namespace detail
template <class D>
inline void make_getter(D const& d)
{
detail::make_getter(d, detail::not_specified(), 0L);
}
const int i = 0;
void compilability_test()
{
make_getter(&i);
}
cxxosf.zko.hp.com> eccp --version -c x.cpp
Edison Design Group C/C++ Front End, version 3.5 (Dec 20 2004 13:57:48)
Copyright 1988-2004 Edison Design Group, Inc.
"x.cpp", line 11: error: more than one instance of overloaded function
"detail::make_getter" matches the argument list:
function template
"void detail::make_getter(D *, const Policies &, int)"
function template "void detail::make_getter(D *,
detail::not_specified, long)"
function template "void detail::make_getter(D &, P &, ...)"
argument types are: (const int *, detail::not_specified, int)
detail::make_getter(d, policy, 0);
^
detected during instantiation of "void detail::make_getter(D *,
detail::not_specified, long) [with D=const int]"
1 error detected in the compilation of "x.cpp".
cxxosf.zko.hp.com> eccp -c --dep_name x.cpp
cxxosf.zko.hp.com>
bash-2.03$ aCC -V
aCC: HP C/aC++ B3910B A.06.14 [Dec 21 2006]
bash-2.03$ aCC -c x.cpp
"x.cpp", line 11: error #2308: more than one instance of overloaded function
"detail::make_getter" matches the argument list:
function template
"void detail::make_getter(D *, const Policies &, int)"
function template "void detail::make_getter(D *,
detail::not_specified, long)"
function template "void detail::make_getter(D &, P &, ...)"
argument types are: (const int *, detail::not_specified, int)
detail::make_getter(d, policy, 0);
^
detected during instantiation of "void detail::make_getter(D *,
detail::not_specified, long) [with D=const int]" at line 21
1 error detected in the compilation of "x.cpp".
bash-2.03$ aCC -c +dep_name x.cpp
bash-2.03$
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk