Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/gcc.dg/c2x-attr-fallthrough-5.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
line wrap: on
line source
/* Test C2x fallthrough attribute: mixtures with other attributes. */ /* { dg-do compile } */ /* { dg-options "-std=c2x -pedantic-errors" } */ /* Use of other standard attributes together with "fallthrough" goes through a different path to diagnosing ignored attributes from that used in attribute declarations without "fallthrough". Verify that such ignored attributes result in a pedwarn (for use in a context not permitted in the constraints for those attributes) in this case as well. */ int f (int a) { switch (a) { case 1: a++; [[fallthrough, deprecated]]; /* { dg-error "attribute ignored" } */ case 2: a++; [[maybe_unused]] [[fallthrough]]; /* { dg-error "attribute ignored" } */ case 3: a++; [[__nodiscard__, fallthrough]]; /* { dg-error "attribute ignored" } */ case 4: a++; } return a; }