modocache added inline comments.

================
Comment at: lib/Parse/ParseStmt.cpp:2293
   // FIXME: Possible draft standard bug: attribute-specifier should be allowed?
   StmtResult Block(ParseCompoundStatement());
   if (Block.isInvalid())
----------------
riccibruno wrote:
> Just to make sure I understood the problem correctly, the issue was that you 
> passed `ScopeFlags` to `ParseCompoundStatement()`. This override the default 
> flags which are `Scope::DeclScope | Scope::CompoundStmtScope`. In particular 
> now `ParseCompoundStatement()` was done as if in the controlling scope of an 
> if statement. Now as per [basic.scope.block]/p4:
> 
> > Names declared in the init-statement, the for-range-declaration, and in the 
> > condition of if, while, for, and switch statements are local to the if, 
> > while, for, or switch statement (including the controlled statement), and 
> > shall not be redeclared in a subsequent condition of that statement nor in 
> > the outermost block (or, for the if statement, any of the outermost blocks) 
> > of the controlled statement; see 9.4.
> 
> This caused the declaration in the compound statement to be detected as 
> erroneous. Indeed the following worked just fine. 
> 
> ```
> void f() {
>     try {}
>     catch (...) {
>         int i;
>         {
>             {
>                 int i;
>             }
>         }
>     }
> }
> ```
> 
> Does this make sense or I am completely off base here ?
> 
That's exactly my understanding, yes! In fact thank you for the clear 
explanation.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59752/new/

https://reviews.llvm.org/D59752



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

Reply via email to