[Bug libstdc++/54451] c++11/random.cc build failure when _GLIBCXX_USE_C99_STDINT_TR1 is not defined in config.h
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Sep 9 17:20:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54451
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-09-09 17:19:44 UTC ---
(In reply to comment #4)
> Maybe it would be nice to use #error in header file to inform the user that
> this feature is not supported for target system (nicer than to get linker error
> later)
You won't get a linker error, if the macro is not defined then the types in
<random> are not declared, so code using them won't compile.
Using #error would prevent #include <random> which I don't think is a good
idea. There's no harm including the header as long as you don't try to use
types which require a working <stdint.h>
The fix is to simply make random.cc check the macro. This is what we already do
in future.cc and thread.cc and mutex.cc and other files too.
More information about the Gcc-bugs
mailing list