[PATCH] D157297: [clang] Fixes compile error that double colon operator cannot resolve macro with parentheses.
Phoebe Wang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 16 19:12:00 PDT 2023
pengfei added a comment.
In D157297#4592851 <https://reviews.llvm.org/D157297#4592851>, @aaron.ballman wrote:
> 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.
Thanks @aaron.ballman for the detailed explanation! I have learnt it. @lygstate maybe include Aaron's explanation in commit message?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157297/new/
https://reviews.llvm.org/D157297
More information about the cfe-commits
mailing list