diff options
author | Alexander Kornienko <alexfh@google.com> | 2012-06-20 21:12:23 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2012-06-20 21:12:23 +0000 |
commit | 9a34889efeea9cb1bacb35578b72a140f89e70f0 (patch) | |
tree | 348a6ebf3770d4d6d313debfd7d162955fbd1357 /clang/test | |
parent | dc753b625ff21ea2ea91747bb92ea8da29a0f340 (diff) | |
download | bcm5719-llvm-9a34889efeea9cb1bacb35578b72a140f89e70f0.tar.gz bcm5719-llvm-9a34889efeea9cb1bacb35578b72a140f89e70f0.zip |
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)
llvm-svn: 158854
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/SemaCXX/switch-implicit-fallthrough.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/switch-implicit-fallthrough.cpp b/clang/test/SemaCXX/switch-implicit-fallthrough.cpp index 02532e801ac..cfc29c237c2 100644 --- a/clang/test/SemaCXX/switch-implicit-fallthrough.cpp +++ b/clang/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<long>(n) * n; + switch (sizeof(p)) { + case 9: // this test will not work on compilers with 72-bit long + n += static_cast<int>(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<int>(p); + break; + default: + break; + } +#endif + return n; } |