https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120978
Harald van Dijk <harald at gigawatt dot nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |harald at gigawatt dot nl --- Comment #9 from Harald van Dijk <harald at gigawatt dot nl> --- I think Andrew is right for C++, but wrong for C. The relevant part in the phases of translation is translation phase 7: "Each preprocessing token is converted into a token". In C++, although #, ##, %: and %:%: are valid pp-tokens, they are not valid tokens: https://eel.is/c++draft/lex.token includes only operator-or-punctuator, not preprocessing-op-or-punc. In C, however, #, ##, %: and %:%: are included in punctuators, making them valid tokens, and there does not seem to be any rule disallowing them in a balanced-token-sequence. I would be highly surprised if this difference between C and C++ is intentional.