On Mon, 2010-01-11 at 10:24 -0600, Roman Kononov wrote: > #g++ --version | head -1 > g++ (GCC) 4.4.3 20091228 (prerelease) > #cat test.cc > typedef _Decimal32 my_type; > #gcc -c test.cc > #g++ -c test.cc > test.cc:1: error: '_Decimal32' does not name a type > > G++ is unfamiliar with the _DecimalXX types. Is it a "feature", bug or lack > of development? > > #cat test.cc > typedef __decltype(0.0DF) my_type; > my_type foo(my_type v) { return v; } > #g++ -c test.cc > test.cc:2: internal compiler error: in write_builtin_type, at cp/mangle.c:1855 > Please submit a full bug report, > with preprocessed source if appropriate. > See <http://gcc.gnu.org/bugs.html> for instructions. > > The same question. > > Thanks :) >
G++ doesn't recognize _Decimal32 and friends because the C++ standards committee decided that decimal floating point types should be provided via classes rather than builtin types. Some of the support for those classes is in current trunk, but a crucial change to the compiler to allow binary compatibility between those classes and the C builtin types wasn't approved before the 4.5 feature cutoff (see http://gcc.gnu.org/ml/gcc-patches/2009-11/msg01321.html). Having said that, the GNU C++ compiler knows about decimal floating point type modes and you can get to the decimal float support via typedefs: typedef float dec32 __attribute__((mode(SD))); typedef float dec64 __attribute__((mode(DD))); typedef float dec128 __attribute__((mode(TD))); Instead of dec32/64/128 you could use _Decimal32/64/128, but the C++ TR requires that float.h define those symbols as typedefs to the classes so you'd run into conflicts later. There are a few changes needed in the G++ compiler for decimal float to work properly; see patches added in trunk revisions r152030, r152242 (this one fixes your ICE), and r152408. In trunk, tests for builtin decimal float support in G++ are in gcc/testsuite/c-c++-common/dfp. Janis