#define FOO
#define BAR defined(FOO)
#if BAR
#error "true"
#else
#error "false"
#endif
Clang, GCC, and ICC evaluate the "true" branch, while MSVC evaluates the "false" branch.
For the same test code with first line changed to "undef":
#undef FOO
#define BAR defined(FOO)
#if BAR
#error "true"
#else
#error "false"
#endif
MSVC, Clang, GCC, and ICC all agree on "false".
Importantly, though, when used with "/Wall", MSVC gives this error message in both cases:
main.cpp(3): warning C4668: 'definedFOO' is not defined as
a preprocessor macro, replacing with '0' for '#if/#elif'
None of the other three compilers give any warnings even with '-Wall -Wextra -pedantic". So there definitely is a difference in behavior, but I don't think it's actually the one that's presumed in that bug.
For further experimentation, Clang, GCC, and ICC can be tested online here: http://gcc.godbolt.org/
For the same test code with first line changed to "undef":
MSVC, Clang, GCC, and ICC all agree on "false".Importantly, though, when used with "/Wall", MSVC gives this error message in both cases:
None of the other three compilers give any warnings even with '-Wall -Wextra -pedantic". So there definitely is a difference in behavior, but I don't think it's actually the one that's presumed in that bug.For further experimentation, Clang, GCC, and ICC can be tested online here: http://gcc.godbolt.org/
And MSVC can be tested online here: http://webcompiler.cloudapp.net/