This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug preprocessor/58844] [4.8 Regression] ICE with invalid use of ##


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58844

--- Comment #11 from David Krauss <potswa at mac dot com> ---
On 2014â08â12, at 3:10 PM, jakub at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
wrote:

> Please see https://gcc.gnu.org/ml/gcc-patches/2009-04/msg01490.html for
> reasoning why gcc considers it valid.

That reasoning goes awry at âISO C is silent about this possibility.â C and C++
both say,

> each instance of a ## preprocessing token in the replacement list (not from an argument) is deleted and the preceding preprocessing token is concatenated with the following preprocessing token.

This is unambiguous in that consecutive ## tokens get pasted; they canât all be
operators. The spec also says, âThe order of evaluation of ## operators is
unspecified,â which doesnât seem like much of a constraint but it does suggest
that they are evaluated one-by-one.

The standard also says âIf the result is not a valid preprocessing token, the
behavior is undefined,â so no diagnosis is required. However, there have been a
couple proposals to make it required, so itâs a very good idea. Even if the
user really meant them to be operators, it wonât be portable.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]