Yes, the extra test would be good. Thanks!
On 24 Jun 2014 18:08, "Alexander Kornienko" <[email protected]> wrote:

> On Tue, Jun 24, 2014 at 4:43 PM, Richard Smith <[email protected]>
> wrote:
>
>> LGTM
>>
>> If blocks also need a fix, feel free to do that in a later patch :)
>>
>
> Oh, you're right, I didn't think about blocks. For some reason bodies of
> blocks are not duplicated in the AST, as it is with lambdas, so the warning
> works fine with them. If you want, I can add a test for this:
>
> $ cat test/SemaCXX/switch-implicit-fallthrough-blocks.cpp
> // RUN: %clang_cc1 -fsyntax-only -verify -fblocks -std=c++11 
> -Wimplicit-fallthrough %s
>
> void fallthrough_in_blocks() {
>   void (^block)() = ^{
>     int x = 0;
>     switch (x) {
>     case 0:
>       x++;
>       [[clang::fallthrough]]; // no diagnostics
>     case 1:
>       x++;
>     default: // \
>         expected-warning{{unannotated fall-through between switch labels}} \
>         expected-note{{insert 'break;' to avoid fall-through}}
>       break;
>     }
>   };
>   block();
> }
>
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to