diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-06-20 18:41:26 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-06-20 18:41:26 +0000 |
commit | 01bf777597471dba914a1e1fae7ef5f8f48e493b (patch) | |
tree | df2e18b93ad4447591519e91d3d1a62c54af5a87 /clang/test | |
parent | c7df1922794b1c562b8c4fb68f02ff986eca0fff (diff) | |
download | bcm5719-llvm-01bf777597471dba914a1e1fae7ef5f8f48e493b.tar.gz bcm5719-llvm-01bf777597471dba914a1e1fae7ef5f8f48e493b.zip |
Warn for un-parenthesized '&' inside '|' (a & b | c), rdar://9553326.
Patch by Henry Mason with tweaks by me.
llvm-svn: 133453
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Sema/parentheses.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/Sema/parentheses.c b/clang/test/Sema/parentheses.c index 95e0a930fe8..13ea3ecbe16 100644 --- a/clang/test/Sema/parentheses.c +++ b/clang/test/Sema/parentheses.c @@ -26,6 +26,12 @@ void bitwise_rel(unsigned i) { (void)(i == 1 | i == 2 | i == 3); (void)(i != 1 & i != 2 & i != 3); + (void)(i & i | i); // expected-warning {{'&' within '|'}} \ + // expected-note {{place parentheses around the '&' expression to silence this warning}} + + (void)(i | i & i); // expected-warning {{'&' within '|'}} \ + // expected-note {{place parentheses around the '&' expression to silence this warning}} + (void)(i || i && i); // expected-warning {{'&&' within '||'}} \ // expected-note {{place parentheses around the '&&' expression to silence this warning}} |