This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug preprocessor/12607] preprocessor fails to diagnose an undefined ## result
- From: "neil at daikokuya dot co dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Oct 2003 05:50:40 -0000
- Subject: [Bug preprocessor/12607] preprocessor fails to diagnose an undefined ## result
- References: <20031013234821.12607.sebor@roguewave.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12607
------- Additional Comments From neil at daikokuya dot co dot uk 2003-10-14 05:50 -------
Subject: Re: 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.