http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51364
Bug #: 51364 Summary: C++ interoperability with ISO-C extension DFP types requires explicit typedefs. Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: r...@us.ibm.com The following code requires explicit typedefs for _Decimal[32|64|128] in C++ programs in order to be able to use the ISO-C extension DFP types. #include <errno.h> #include <decimal> #include <stdio.h> #include <dfp/stdlib.h> int main() { char buffer[] = "0.0"; _Decimal64 x = -1.0DD; errno = 0; x = strtod64(buffer, NULL); printf("%0.16De\n", x); return 0; } /opt/at4.0/bin/g++ -g -isystem/opt/at4.0/include/c++/4.5.4/decimal -D__STDC_WANT_DEC_FP__ strtod.cpp -ldfp -o d In file included from strtod.cpp:9:0: /opt/at4.0/include/dfp/stdlib.h:37:8: error: '_Decimal32' does not name a type /opt/at4.0/include/dfp/stdlib.h:42:8: error: '_Decimal64' does not name a type /opt/at4.0/include/dfp/stdlib.h:47:8: error: '_Decimal128' does not name a type ... This is solved be declaring the following prior to the inclusion of <dfp/stdlib.h> (which is where the _Decimal types are first encountered): typedef float _Decimal32 __attribute__((mode(SD))); typedef float _Decimal64 __attribute__((mode(DD))); typedef float _Decimal128 __attribute__((mode(TD))); Should these typedefs be implicitly defined when using the std::decimal namespace?