I'm facing an compilation issues with sc_dt::sc_biguint data types. I tried to reproduce the issue with a simple example below
#include<iostream>
#include<systemc.h>
using namespace std;
template<typename DATA_TYPE>
class base {
public:
void fun(DATA_TYPE ind){
}
void fun(std::string name){
}
};
int sc_main(int argc, char* argv[]){
base<uint64_t> b1;
b1.fun(0);
b1.fun("a");
base<sc_dt::sc_biguint<128>> b2;
b2.fun(0);
b2.fun("a");
return 0;
}
Here the call to overloaded function fun() is compiling fine for b1 which is using uint64_t as template. Also if I use uin8_t, uint16_t it compiles fine. But as soon as I use systemc data types (e.g. sc_biguint data type), I get the compilation errors like following
../test.cpp: In function ‘int sc_main(int, char**)’:
../test.cpp:21:13: error: call of overloaded ‘fun(int)’ is ambiguous
b2.fun(0);
^
../test.cpp:8:10: note: candidate: void base<DATA_TYPE>::fun(DATA_TYPE) [with DATA_TYPE = sc_dt::sc_biguint<128>]
void fun(DATA_TYPE ind){
^~~
../test.cpp:11:10: note: candidate: void base<DATA_TYPE>::fun(std::__cxx11::string) [with DATA_TYPE = sc_dt::sc_biguint<128>; std::__cxx11::string = std::__cxx11::basic_string<char>]
void fun(std::string name){
^~~
../test.cpp:22:15: error: call of overloaded ‘fun(const char [2])’ is ambiguous
b2.fun("a");
^
../test.cpp:8:10: note: candidate: void base<DATA_TYPE>::fun(DATA_TYPE) [with DATA_TYPE = sc_dt::sc_biguint<128>]
void fun(DATA_TYPE ind){
^~~
../test.cpp:11:10: note: candidate: void base<DATA_TYPE>::fun(std::__cxx11::string) [with DATA_TYPE = sc_dt::sc_biguint<128>; std::__cxx11::string = std::__cxx11::basic_string<char>]
void fun(std::string name){
sc_dt::sc_biguint<128>has the implicit conversion constructorsc_biguint( const sc_bv_base& v )andsc_bv_basehas the implicit conversion constructorsc_bv_base( const char* a );. You are unlucky. Perhaps, you need to specializetemplate<size_t N> class base<sc_dt::sc_biguint<N>>.