1/* PR c/7652 */ 2/* { dg-do compile } */ 3/* { dg-options "-Wimplicit-fallthrough" } */ 4/* Test taken from 5 <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0188r0.pdf>. */ 6 7extern void f (int); 8 9void 10foo (int n) 11{ 12 switch (n) 13 { 14 case 22: 15 case 33: 16 f (1); /* { dg-warning "statement may fall through" } */ 17 case 44: 18 f (2); 19 __attribute__((fallthrough)); 20 case 55: 21 if (n > 10) 22 { 23 f (3); 24 break; 25 } 26 else 27 { 28 f (4); 29 __attribute__((fallthrough)); 30 } 31 case 66: 32 f (5); 33 __attribute__((fallthrough)); /* { dg-warning "not preceding" } */ 34 f (6); /* { dg-warning "statement may fall through" } */ 35 case 77: 36 f (7); 37 } 38} 39