This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: [Bug preprocessor/12607] preprocessor fails to diagnose an undefined ## result
sebor at roguewave dot com wrote:-
> I see. I think I agree with you: it's the pp-token immediatley preceding the ##
> operator that, after concatenation, must form another valid token, and it is not
> required that the pp-token (or sequence thereof) substituted for the macro
> parameter form a single valid token after concatentation. Looks like HP
> misinterpreted this the same way I did -- their preprocessor complains (see below).
But "sequence thereof" is a useless concept in this context. The stand
is quite clear - ## pastes just two tokens to create a token.
> Warning (anachronism) 823: "t.cpp", line 6 # Redundant preprocessing
> concatenation operation results in two valid preprocessing tokens. Depending on
> this implementation defined behavior will result in non-portable code.
> /* 6 */ int j = CAT (s.a, b); // #2
> ^
> int j = s.ab ;
This is simply wrong. I bet you can't find a single compiler that
gets this wrong. Further, there is nothing redundant about the ##;
if any compiler works in the way you intend with it *missing* then that
compiler is buggy. I suggest you report this as a bug to EDG.
Neil.