$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
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 t.cc  # gcc-4.8.2 compilation
t.cc:17:62: error: ambiguous class template instantiation for 'struct 
canonical_imp<number<cpp_dec_float<50u>, 
(expression_template_option)1u>, cpp_dec_float<50u>, int_<3> >'
CC  -c -std=c++11 t.cc # Oracle Studio 12.4 C++ compilation
"t.cc", 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>.
t.cc
==================================
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 
canonical_imp<Val,Backend,int_<3>>{
  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 {
  public:
   number() {}
   template <class V> number(const V& v,typename 
enable_if_c<!is_restricted_conversion<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() {
   instantiate(test_type());
}
===============================
Any suggestions how to fix this?
Thanks,
Sergey