Bugzilla – Bug 1500
error-model.cc:253: error: call of overloaded pow(double, uint32_t) is ambiguous
Last modified: 2012-09-14 19:10:13 UTC
https://ns-buildmaster.ee.washington.edu:8010/job/osx-mlion-ns-3-allinone/10/label=master/console [ 759/1875] cxx: src/energy/model/rv-battery-model.cc -> build/src/energy/model/rv-battery-model.cc.1.o ../src/network/utils/error-model.cc: In member function ‘virtual bool ns3::RateErrorModel::DoCorruptByte(ns3::Ptr<ns3::Packet>)’: ../src/network/utils/error-model.cc:253: error: call of overloaded ‘pow(double, uint32_t)’ is ambiguous /usr/include/math.h:436: note: candidates are: double pow(double, double) /usr/include/c++/4.2.1/cmath:357: note: float std::pow(float, float) /usr/include/c++/4.2.1/cmath:361: note: long double std::pow(long double, long double) /usr/include/c++/4.2.1/cmath:365: note: double std::pow(double, int) /usr/include/c++/4.2.1/cmath:369: note: float std::pow(float, int) /usr/include/c++/4.2.1/cmath:373: note: long double std::pow(long double, int) ../src/network/utils/error-model.cc: In member function ‘virtual bool ns3::RateErrorModel::DoCorruptBit(ns3::Ptr<ns3::Packet>)’: ../src/network/utils/error-model.cc:262: error: call of overloaded ‘pow(double, unsigned int)’ is ambiguous /usr/include/math.h:436: note: candidates are: double pow(double, double) /usr/include/c++/4.2.1/cmath:357: note: float std::pow(float, float) /usr/include/c++/4.2.1/cmath:361: note: long double std::pow(long double, long double) /usr/include/c++/4.2.1/cmath:365: note: double std::pow(double, int) /usr/include/c++/4.2.1/cmath:369: note: float std::pow(float, int) /usr/include/c++/4.2.1/cmath:373: note: long double std::pow(long double, int) [ 760/1875] cxx: src/mesh/test/mesh-information-element-vector-test-suite.cc -> build/src/mesh/test/mesh-information-element-vector-test-suite.cc.3.o Waf: Leaving directory `/Users/buildmaster/.hudson/jobs/osx-mlion-ns-3-allinone/workspace/label/master/ns-3-allinone/ns-3-dev/build' Build failed
../src/wimax/model/bs-uplink-scheduler-mbqos.cc: In member function ‘void ns3::UplinkSchedulerMBQoS::UplinkSchedWindowTimer()’: ../src/wimax/model/bs-uplink-scheduler-mbqos.cc:198: error: call of overloaded ‘abs(uint32_t)’ is ambiguous /usr/include/stdlib.h:146: note: candidates are: int abs(int) /usr/include/c++/4.2.1/cstdlib:143: note: long int std::abs(long int) /usr/include/c++/4.2.1/cstdlib:174: note: long long int __gnu_cxx::abs(long long int) /usr/include/c++/4.2.1/cmath:89: note: double std::abs(double) /usr/include/c++/4.2.1/cmath:93: note: float std::abs(float) /usr/include/c++/4.2.1/cmath:97: note: long double std::abs(long double)
../src/lte/model/lte-mi-error-model.cc: In static member function ‘static double ns3::LteMiErrorModel::GetTbError(const ns3::SpectrumValue&, const std::vector<int, std::allocator<int> >&, uint16_t, uint8_t)’: ../src/lte/model/lte-mi-error-model.cc:480: error: call of overloaded ‘pow(double, uint32_t&)’ is ambiguous /usr/include/math.h:436: note: candidates are: double pow(double, double) /usr/include/c++/4.2.1/cmath:357: note: float std::pow(float, float) /usr/include/c++/4.2.1/cmath:361: note: long double std::pow(long double, long double) /usr/include/c++/4.2.1/cmath:365: note: double std::pow(double, int) /usr/include/c++/4.2.1/cmath:369: note: float std::pow(float, int) /usr/include/c++/4.2.1/cmath:373: note: long double std::pow(long double, int) ../src/lte/model/lte-mi-error-model.cc:482: error: call of overloaded ‘pow(double, uint32_t&)’ is ambiguous /usr/include/math.h:436: note: candidates are: double pow(double, double) /usr/include/c++/4.2.1/cmath:357: note: float std::pow(float, float) /usr/include/c++/4.2.1/cmath:361: note: long double std::pow(long double, long double) /usr/include/c++/4.2.1/cmath:365: note: double std::pow(double, int) /usr/include/c++/4.2.1/cmath:369: note: float std::pow(float, int) /usr/include/c++/4.2.1/cmath:373: note: long double std::pow(long double, int)
../src/wifi/model/dsss-error-rate-model.cc: In static member function ‘static double ns3::DsssErrorRateModel::GetDsssDbpskSuccessRate(double, uint32_t)’: ../src/wifi/model/dsss-error-rate-model.cc:46: error: call of overloaded ‘pow(double, uint32_t&)’ is ambiguous /usr/include/math.h:436: note: candidates are: double pow(double, double) /usr/include/c++/4.2.1/cmath:357: note: float std::pow(float, float) /usr/include/c++/4.2.1/cmath:361: note: long double std::pow(long double, long double) /usr/include/c++/4.2.1/cmath:365: note: double std::pow(double, int) /usr/include/c++/4.2.1/cmath:369: note: float std::pow(float, int) /usr/include/c++/4.2.1/cmath:373: note: long double std::pow(long double, int) ../src/wifi/model/dsss-error-rate-model.cc: In static member function ‘static double ns3::DsssErrorRateModel::GetDsssDqpskSuccessRate(double, uint32_t)’: ../src/wifi/model/dsss-error-rate-model.cc:54: error: call of overloaded ‘pow(double, uint32_t&)’ is ambiguous /usr/include/math.h:436: note: candidates are: double pow(double, double) /usr/include/c++/4.2.1/cmath:357: note: float std::pow(float, float) /usr/include/c++/4.2.1/cmath:361: note: long double std::pow(long double, long double) /usr/include/c++/4.2.1/cmath:365: note: double std::pow(double, int) /usr/include/c++/4.2.1/cmath:369: note: float std::pow(float, int) /usr/include/c++/4.2.1/cmath:373: note: long double std::pow(long double, int) ../src/wifi/model/dsss-error-rate-model.cc: In static member function ‘static double ns3::DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate(double, uint32_t)’: ../src/wifi/model/dsss-error-rate-model.cc:86: error: call of overloaded ‘pow(double, uint32_t&)’ is ambiguous /usr/include/math.h:436: note: candidates are: double pow(double, double) /usr/include/c++/4.2.1/cmath:357: note: float std::pow(float, float) /usr/include/c++/4.2.1/cmath:361: note: long double std::pow(long double, long double) /usr/include/c++/4.2.1/cmath:365: note: double std::pow(double, int) /usr/include/c++/4.2.1/cmath:369: note: float std::pow(float, int) /usr/include/c++/4.2.1/cmath:373: note: long double std::pow(long double, int) ../src/wifi/model/dsss-error-rate-model.cc: In static member function ‘static double ns3::DsssErrorRateModel::GetDsssDqpskCck11SuccessRate(double, uint32_t)’: ../src/wifi/model/dsss-error-rate-model.cc:121: error: call of overloaded ‘pow(double, uint32_t&)’ is ambiguous /usr/include/math.h:436: note: candidates are: double pow(double, double) /usr/include/c++/4.2.1/cmath:357: note: float std::pow(float, float) /usr/include/c++/4.2.1/cmath:361: note: long double std::pow(long double, long double) /usr/include/c++/4.2.1/cmath:365: note: double std::pow(double, int) /usr/include/c++/4.2.1/cmath:369: note: float std::pow(float, int) /usr/include/c++/4.2.1/cmath:373: note: long double std::pow(long double, int) ../src/wifi/model/nist-error-rate-model.cc: In member function ‘double ns3::NistErrorRateModel::GetFec16QamBer(double, uint32_t, uint32_t) const’: ../src/wifi/model/nist-error-rate-model.cc:175: error: call of overloaded ‘pow(double, uint32_t&)’ is ambiguous /usr/include/math.h:436: note: candidates are: double pow(double, double) /usr/include/c++/4.2.1/cmath:357: note: float std::pow(float, float) /usr/include/c++/4.2.1/cmath:361: note: long double std::pow(long double, long double) /usr/include/c++/4.2.1/cmath:365: note: double std::pow(double, int) /usr/include/c++/4.2.1/cmath:369: note: float std::pow(float, int) /usr/include/c++/4.2.1/cmath:373: note: long double std::pow(long double, int) ../src/wifi/model/nist-error-rate-model.cc: In member function ‘double ns3::NistErrorRateModel::GetFec64QamBer(double, uint32_t, uint32_t) const’: ../src/wifi/model/nist-error-rate-model.cc:189: error: call of overloaded ‘pow(double, uint32_t&)’ is ambiguous /usr/include/math.h:436: note: candidates are: double pow(double, double) /usr/include/c++/4.2.1/cmath:357: note: float std::pow(float, float) /usr/include/c++/4.2.1/cmath:361: note: long double std::pow(long double, long double) /usr/include/c++/4.2.1/cmath:365: note: double std::pow(double, int) /usr/include/c++/4.2.1/cmath:369: note: float std::pow(float, int) /usr/include/c++/4.2.1/cmath:373: note: long double std::pow(long double, int) ../src/wifi/model/yans-error-rate-model.cc: In member function ‘double ns3::YansErrorRateModel::Binomial(uint32_t, double, uint32_t) const’: ../src/wifi/model/yans-error-rate-model.cc:86: error: call of overloaded ‘pow(double&, uint32_t&)’ is ambiguous /usr/include/math.h:436: note: candidates are: double pow(double, double) /usr/include/c++/4.2.1/cmath:357: note: float std::pow(float, float) /usr/include/c++/4.2.1/cmath:361: note: long double std::pow(long double, long double) /usr/include/c++/4.2.1/cmath:365: note: double std::pow(double, int) /usr/include/c++/4.2.1/cmath:369: note: float std::pow(float, int) /usr/include/c++/4.2.1/cmath:373: note: long double std::pow(long double, int) ../src/wifi/model/yans-error-rate-model.cc:86: error: call of overloaded ‘pow(double, unsigned int)’ is ambiguous /usr/include/math.h:436: note: candidates are: double pow(double, double) /usr/include/c++/4.2.1/cmath:357: note: float std::pow(float, float) /usr/include/c++/4.2.1/cmath:361: note: long double std::pow(long double, long double) /usr/include/c++/4.2.1/cmath:365: note: double std::pow(double, int) /usr/include/c++/4.2.1/cmath:369: note: float std::pow(float, int) /usr/include/c++/4.2.1/cmath:373: note: long double std::pow(long double, int) ../src/wifi/model/yans-error-rate-model.cc: In member function ‘double ns3::YansErrorRateModel::GetFecQamBer(double, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t) const’: ../src/wifi/model/yans-error-rate-model.cc:171: error: call of overloaded ‘pow(double, uint32_t&)’ is ambiguous /usr/include/math.h:436: note: candidates are: double pow(double, double) /usr/include/c++/4.2.1/cmath:357: note: float std::pow(float, float) /usr/include/c++/4.2.1/cmath:361: note: long double std::pow(long double, long double) /usr/include/c++/4.2.1/cmath:365: note: double std::pow(double, int) /usr/include/c++/4.2.1/cmath:369: note: float std::pow(float, int) /usr/include/c++/4.2.1/cmath:373: note: long double std::pow(long double, int)
this is seen in fedora ../src/mpi/examples/nms-p2p-nix-distributed.cc: In function ‘int main(int, char**)’: ../src/mpi/examples/nms-p2p-nix-distributed.cc:74:3: error: ‘cout’ was not declared in this scope ../src/mpi/examples/nms-p2p-nix-distributed.cc:74:3: note: suggested alternative: /usr/lib/gcc/x86_64-redhat-linux/4.6.3/../../../../include/c++/4.6.3/iostream:62:18: note: ‘std::cout’ ../src/mpi/examples/nms-p2p-nix-distributed.cc:74:63: error: ‘endl’ was not declared in this scope ../src/mpi/examples/nms-p2p-nix-distributed.cc:74:63: note: suggested alternative: /usr/lib/gcc/x86_64-redhat-linux/4.6.3/../../../../include/c++/4.6.3/ostream:543:5: note: ‘std::endl’ Waf: Leaving directory `/home/buildslave/jenkins/workspace/daily-without-valgrind/label/Fedora-64-16/ns-3-allinone/ns-3-dev/build' Build failed
Sorry for this inconvenience. I will try to fix these ASAP.
Created attachment 1445 [details] Fedora one is simple. Will commit it when I get home.
Tom, I was thinking about this bug, and only solution (besides using static_cast everywhere as you did) is that we provide some aditional definitions for pow() and abs() inside ns3/math.h? How do you feel about it?
(In reply to comment #7) > Tom, I was thinking about this bug, and only solution (besides using > static_cast everywhere as you did) is that we provide some aditional > definitions for pow() and abs() inside ns3/math.h? How do you feel about it? I believe that the reason that the standard libraries do not include such variants is due to the different data type ranges. So, I would probably opt for people to use the functions with the library-supported types, even if they have to cast, rather than try to provide "unsafe" variants just for convenience of our users. If no other comments or opinions on this, we could close the bug? All of the noted issues have been fixed.
Sure.