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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to