[Bug libstdc++/1773] __cplusplus defined to 1, should be 199711L

andrew at ishiboo dot com gcc-bugzilla@gcc.gnu.org
Wed Aug 3 20:18:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1773

Andrew Paprocki <andrew at ishiboo dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrew at ishiboo dot com

--- Comment #104 from Andrew Paprocki <andrew at ishiboo dot com> 2011-08-03 20:17:26 UTC ---
Wow, just got bit by this 10 year old bug on Solaris 10. The following code
correctly errors with Sun's compiler:

#include <string.h>
int main() { char* foo = strchr("z", 'z'); return 0; }

"foo.c", line 2:  Error: Cannot assign const char* to char*.

But under no invocation of g++ does this even print a warning (-Wall -Wextra
-Wcast-qual) because Solaris iso/string_iso.h only declares the return value
'const' when __cplusplus >= 199711L.



More information about the Gcc-bugs mailing list