From: Alexander Kornienko Date: Wed, 20 Jun 2012 21:12:23 +0000 (+0000) Subject: Added test with sizeof conditions (relies on to-be-implemented functionality of CFG... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=86197b311ddb938c9605fdc3e4e57157c4cfe9bd;p=clang Added test with sizeof conditions (relies on to-be-implemented functionality of CFG, discussion: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120507/057370.html) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158854 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/SemaCXX/switch-implicit-fallthrough.cpp b/test/SemaCXX/switch-implicit-fallthrough.cpp index 02532e801a..cfc29c237c 100644 --- a/test/SemaCXX/switch-implicit-fallthrough.cpp +++ b/test/SemaCXX/switch-implicit-fallthrough.cpp @@ -156,6 +156,24 @@ int fallthrough_position(int n) { case 223: // expected-warning{{unannotated fall-through between switch labels}} expected-note{{insert '[[clang::fallthrough]];' to silence this warning}} expected-note{{insert 'break;' to avoid fall-through}} [[clang::fallthrough]]; // expected-warning{{fallthrough annotation does not directly precede switch label}} } + + // TODO: uncomment this test after CFG gets more options to deal with + // unreachable code: + // http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120507/057370.html +#if 0 + long p = static_cast(n) * n; + switch (sizeof(p)) { + case 9: // this test will not work on compilers with 72-bit long + n += static_cast(p >> 32); + [[clang::fallthrough]]; // no warning here + case 5: // it is not intended to work on compilers with 40-bit long as well + n += static_cast(p); + break; + default: + break; + } +#endif + return n; }