The A()
macro will only expand on MSVC, but not GCC/Clang unless A()
is placed with a prefix e.g. Test A()
.
By running the following snippet under the -E
(/E
) flag (godbolt.org):
#define A() HelloWorld::
#define B() ::
A()
B()
We see MSVC gives the following output:
HelloWorld::
::
And GCC/Clang gives a different output:
::
But then running this snippet:
#define A() HelloWorld::
A()
Test A()
Gives us the following on all 3 compilers:
HelloWorld::
Test HelloWorld::
Why is the GCC/Clang output missing the first line?
Why does it expand all occurrences correctly when Test A()
is written?
Is this well defined within the standard, or is this compiler-specific?