http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58815
Bug ID: 58815 Summary: Casting/Conversion operator for std::decimal not supported Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: q1 at oxyba dot de it is not really a bug a rather something missing. example: #include<decimal/decimal> int main(){ std::decimal::decimal64 x(101.5001); long y = static_cast<long>(x); // throws an error return 0; } this will throw an error "... error: invalid static_cast from type ‘std::decimal::decimal64’ to type ‘long int’..." i know that type working would work using methods of std::decimal::decimal64, e.g. #include<decimal/decimal> int main(){ std::decimal::decimal64 x(101.5001); long long y = std::decimal::decimal64_to_long_long(x); // look here return 0; } As I cannot cicumvent the problem with outside class definition, I please you to add conversion operators to std::decimal, e.g. std::decimal::decimal64::operator long(){return ...;} In general std::decimal is really immature, e.g. no operator<<, not supported in <traits> (it says std::decimal is a floating point).