[Bug libstdc++/1773] __cplusplus defined to 1, should be 199711L
tortoise_74 at yahoo dot co.uk
gcc-bugzilla@gcc.gnu.org
Fri Nov 25 19:29:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1773
Bruce Adams <tortoise_74 at yahoo dot co.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tortoise_74 at yahoo dot
| |co.uk
--- Comment #124 from Bruce Adams <tortoise_74 at yahoo dot co.uk> 2011-11-25 18:33:25 UTC ---
My understanding of the last comment is that for -std=c++11 _cplusplus should
be set so that "#if __cplusplus > 201100L" can be used to conditionally compile
as C++03 vs C++11.
I would expect this to be in the snapshot I'm using but it doesn't seem to be.
Has it regressed or do we need to wait for the next snapshot release?
What other way is there to distinguish C++03 and C++11 in source as a
workaround?
#include <iostream>
int main(int argc, char* argv[])
{
std::cout << __cplusplus << std::endl;
return 0;
}
#!/bin/sh
gcc --version
gcc -Wconversion blah.cpp -oblah -lstdc++
./blah
export LD_LIBRARY_PATH=/opt/gcc4.7/lib:$LD_LIBRARY_PATH
export PATH=/opt/gcc4.7/bin:$PATH
/opt/gcc4.7/bin/gcc --version
/opt/gcc4.7/bin/gcc -std=c++03 blah.cpp -oblah2 -lstdc++
./blah
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-51)
[snip]
1
gcc (GCC) 4.7.0 20111119 (experimental)
[snip]
1
More information about the Gcc-bugs
mailing list