[PATCH] D157297: [clang] Fixes compile error that double colon operator cannot resolve macro with parentheses.
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 16 11:37:59 PDT 2023
aaron.ballman added a comment.
In D157297#4590886 <https://reviews.llvm.org/D157297#4590886>, @pengfei wrote:
> BTW, maybe @aaron.ballman knows why we don't support such syntax in C++.
The return statement expects an expression or braced init list: http://eel.is/c++draft/stmt.jump#general-1 but we really only need to care about the expression form (there's no braces in sight).
Grammatically, the leading `::` will parse as a qualified-id because it matches the production for nested-name-specifier: http://eel.is/c++draft/expr.prim.id.qual#nt:qualified-id
That needs to be followed by an unqualified-id (http://eel.is/c++draft/expr.prim.id.unqual#nt:unqualified-id), but the open paren does not match any of the grammar productions, so this is a syntax error.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157297/new/
https://reviews.llvm.org/D157297
More information about the cfe-commits
mailing list