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

--- Comment #4 from Halalaluyafail3 <luigighiron at gmail dot com> ---
(In reply to Andrew Pinski from comment #3)
> (In reply to Andrew Pinski from comment #2)
> > The C23 spec says:
> > any token other than a parenthesis, a bracket, or a brace
> > 
> > But # is not a token in C; it is only a preprocessor token ...
> 
> I was wrong there, it is a C token but I suspect it is considered either the
> `#` or `##` pp operator which case then would be invalid here.
> And that is why GCC, EDG and MSVC all reject this because those 2 pp
> operators are processed earlier than attribute processing.
> 
> But I could be reading the spec wrong still.
They are only considered operators during macro expansion. The standard
provides the following example:

> #define hash_hash # ## #
> #define mkstr(a) # a
> #define in_between(a) mkstr(a)
> #define join(c, d) in_between(c hash_hash d)
> char p[] = join(x, y); // equivalent to
> // char p[] = "x ## y";
Which demonstrates that a ## token can be used (in this case stringized)
without causing it to be treated as an operator.

Reply via email to