Boost logo

Boost :

Subject: [boost] [multiprecision] [detail] [number_base.hpp] Ambiguous partial specialization for canonical_imp
From: Sergey Sprogis (sergey.sprogis_at_[hidden])
Date: 2014-12-27 21:58:18

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
(expression_template_option)1u>, cpp_dec_float<50u>, int_<3> >'

CC -c -std=c++11 # Oracle Studio 12.4 C++ compilation
"", line 17: Error: Ambiguous partial specialization for
canonical_imp<Val, Backend, Tag><number<cpp_dec_float<50, int, void>,
1>, cpp_dec_float<50, int, void>, int_<3>>, canonical_imp<Val, Backend,
int_<3>> and canonical_imp<number<B, 1>, Backend, Tag>.
template< bool B> struct enable_if_c{
  typedef bool type;
template< int N > struct int_{};
enum expression_template_option {et_on=1};
template <class Backend, expression_template_option ExpressionTemplates>
class number;
template <class Val, class Backend, class Tag> struct canonical_imp {
  typedef int type;
template <class B,class Backend,class Tag> struct
canonical_imp<number<B,et_on>,Backend,Tag> {
  typedef B type;
template <class Val, class Backend> struct
  typedef Val type;
template <class Val, class Backend> struct canonical {
  typedef typename canonical_imp<Val, Backend, int_<3>>::type type;
template<typename From, typename To> struct is_restricted_conversion {
  typedef bool type;
template <class Backend, expression_template_option ExpressionTemplates>
class number {
   number() {}
   template <class V> number(const V& v,typename
canonical<V,Backend>::type,Backend>::value>::type * =0){}
template <unsigned Digits10, class ExponentType = int, class Allocator =
void> class cpp_dec_float;
template <unsigned Digits10, class ExponentType, class Allocator> class
cpp_dec_float {
  public: cpp_dec_float() {}
template <class RealType> void instantiate(RealType) {}
typedef number<cpp_dec_float<50>, et_on> test_type;
void foo() {

Any suggestions how to fix this?



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