www.digitalmars.com         C & C++   DMDScript  

c++ - std::numeric_limits --- Internal error

Simple 2 line source file:

#include <limits>
double foo = std::numeric_limits<double>::infinity();

Compile with

dmc -cpp foo.cc

says

Internal error: blockopt.c 485
--- errorlevel 1

If I throw -v onto the compile command the last bit is

operator ==
operator !=
class std::_F_rep
class std::_D_rep
class std::_L_rep
     'C:\dm856c\bin\..\stlport\stlport\stl/_limits.c'
    'C:\dm856c\bin\..\stlport\stlport\stl/_epilog.h'
     'C:\dm856c\bin\..\stlport\stlport\stl/_config_compat_post.h'
class std::std::_Numeric_limits_base<double >
class std::std::_Floating_limits<double 
,53,15,4294966275,1024,4294966989,308,1,1>
class std::std::numeric_limits<double >
Internal error: blockopt.c 485

--- errorlevel 1

OTOH, it works OK if "double foo = ..." is placed inside a 
function (i.e., not at file or global scope).
Also, using INFINITY from <cmath> in place of 
std::numeric_limits<double>::infinity() works OK.

I see this with both dmc 8.52c and dmc 8.56c.  I'm using stlport 
from

http://ftp.digitalmars.com/Digital_Mars_C++/STL/stlport.zip

I see the above problem with NaNs too.
Mar 05 2013