<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jun 24, 2014 at 4:43 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">LGTM<br>
<br>
If blocks also need a fix, feel free to do that in a later patch :)<br></blockquote><div><br></div><div>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:</div>
<div><pre style="color:rgb(0,0,0)"><pre>$ 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();
}</pre></pre></div></div>
</div></div>