diff options
Diffstat (limited to 'clang/test/Sema')
| -rw-r--r-- | clang/test/Sema/exprs.c | 5 | ||||
| -rw-r--r-- | clang/test/Sema/switch.c | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/clang/test/Sema/exprs.c b/clang/test/Sema/exprs.c index 9d3da908549..56a52bed1bc 100644 --- a/clang/test/Sema/exprs.c +++ b/clang/test/Sema/exprs.c @@ -145,5 +145,8 @@ void test19() { int test20(int x) { return x && 4; // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} - return x && sizeof(int) == 4; // no warning. + return x && sizeof(int) == 4; // no warning, RHS is logical op. + + // no warning, this is an idiom for "true" in old C style. + return x && (signed char)1; } diff --git a/clang/test/Sema/switch.c b/clang/test/Sema/switch.c index 4e39e0f0c2d..bb4822916cc 100644 --- a/clang/test/Sema/switch.c +++ b/clang/test/Sema/switch.c @@ -50,14 +50,12 @@ void test4() } switch (cond) { - case g() && 0: // expected-error {{expression is not an integer constant expression}} // expected-note {{subexpression not valid in an integer constant expression}} \ - expected-warning {{use of logical && with constant operand}} + case g() && 0: // expected-error {{expression is not an integer constant expression}} // expected-note {{subexpression not valid in an integer constant expression}} break; } switch (cond) { - case 0 ... g() || 1: // expected-error {{expression is not an integer constant expression}} // expected-note {{subexpression not valid in an integer constant expression}} \\ - expected-warning {{use of logical || with constant operand}} + case 0 ... g() || 1: // expected-error {{expression is not an integer constant expression}} // expected-note {{subexpression not valid in an integer constant expression}} break; } } |

