Try it with the usual options required to make g++ a C++ compiler:
g++ -std=c++98 -pedantic
Interesting... I've always used:
Even after RTFM I'm still none the wiser as to what precisely the
difference (if any) is...
I think the idea is that "-ansi" is a bit outdated. (It's also
a bit US-centric. The international standard for C++ is ISO,
not ANSI.) It says you want to be conform to an ANSI standard,
but it doesn't say which one. Currently, g++ only supports one
ISO C++ standard, so it doesn't make much difference, but I
imagine that you'd get different behavior for a C program
depending on whether you specified -std=c90 or -std=c99, and
presumably, the same thing will hold once g++ supports
-std=c++03. I don't know which one -ansi gives for C, and I
don't know which one it will give in the future for C++.
As I read in somebody's .sig once: "The nice thing about
standards is that there are so many of them to choose from."
GCC's use of -std=xxx, rather than -ansi, is just a recognition
of this fact.