Boost logo

Boost :

Subject: Re: [boost] [multiprecision] [detail] [number_base.hpp] Ambiguous partial specialization for canonical_imp
From: John Maddock (boost.regex_at_[hidden])
Date: 2014-12-28 07:09:34

> It looks like boost/multiprecision/detail/number_base.hpp header in one
> of the later trunk versions
> has ambiguous partial specialization problem which Oracle Studio 12.4
> C++ compiler detects.
> It can be also detected by gcc-4.8.2 as small 35 lines independent test
> case below made from this header shows.
> gcc -c -std=c++11 # gcc-4.8.2 compilation
> error: ambiguous class template instantiation for 'struct
> canonical_imp<number<cpp_dec_float<50u>,
> (expression_template_option)1u>, cpp_dec_float<50u>, int_<3> >'

Going back to the original code rather than the reduced case, the final
int_<3> implies that the first template argument
(number<cpp_dec_float<50u> in this case) is convertible to const char* -
and that should definitely *not* be the case. To put it another way,
the error message could be a lot better (maybe I'll add a static assert
for this special case), but the ambiguity is justified because:

is_convertible<number<cpp_dec_float<50u> >, const char*>::value

should never be true, and if it is, the code genuinely doesn't know what
to do. So is there a compiler bug effecting is_convertible? Do the
type_traits tests pass?

Merry Christmas, John.

P.S. we will have to figure out a Boost.Config setup for this new
compiler release as well - really great that Sun have revitalised their
compiler with C++11 support.

Boost list run by bdawes at, gregod at, cpdaniel at, john at