I searched this site and cannot find a solution to my problem. I have reduced my sample code to the extent that I think I can, while preserving the corresponding error. I have the following two files left:
test.hpp
namespace models { template<typename FloatingPoint> class ellipsoid { public: explicit ellipsoid(FloatingPoint = 6378137.0); private: FloatingPoint a_; }; template<typename FloatingPoint> ellipsoid<FloatingPoint>::ellipsoid(FloatingPoint a) : a_(a) {} }
test.cpp
#include "test.hpp" int main() { compute(10.0); return 0; }
When I compile the above code using VC ++ 2017, I get the following error:
error C2512: 'models::ellipsoid<FloatingPoint>': no appropriate default constructor available note: No constructor could take the source type, or constructor overload resolution was ambiguous
Both clang and g ++ compile this without any problems. Also, if I remove the ellipsoid class from the models namespace and delete the calls of models:: in the compute function, it then compiles using VC ++. Is this a bug in the VC ++ compiler, or do I have a bug in my code?
source share