diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-01-17 22:06:26 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-01-17 22:06:26 +0000 |
commit | 01a7fba820a612d55d2c09ab734f4c774ba6aa0a (patch) | |
tree | b37845f3857ee871350de05eb01d34ba4547413c /clang/test/SemaCXX/warn-unsequenced.cpp | |
parent | 50dc8a6a388f6fd1140a501b9e9f2d0ef2ef138d (diff) | |
download | bcm5719-llvm-01a7fba820a612d55d2c09ab734f4c774ba6aa0a.tar.gz bcm5719-llvm-01a7fba820a612d55d2c09ab734f4c774ba6aa0a.zip |
-Wunsequenced: if the LHS of an &&, || or ?: is not constant, check for
unsequenced operations in the RHS. We don't compare the RHS with the rest of
the expression yet; such checks will need care to avoid diagnosing unsequenced
operations which are both in conditionally-evaluated subexpressions which
actually can't occur together, such as in '(b && ++x) + (!b && ++x)'.
llvm-svn: 172760
Diffstat (limited to 'clang/test/SemaCXX/warn-unsequenced.cpp')
-rw-r--r-- | clang/test/SemaCXX/warn-unsequenced.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/warn-unsequenced.cpp b/clang/test/SemaCXX/warn-unsequenced.cpp index dcac0975867..15ca1dba7a8 100644 --- a/clang/test/SemaCXX/warn-unsequenced.cpp +++ b/clang/test/SemaCXX/warn-unsequenced.cpp @@ -88,4 +88,11 @@ void test() { xs[0] = (a = 1, a); // ok (a -= 128) &= 128; // ok ++a += 1; // ok + + xs[8] ? ++a + a++ : 0; // expected-warning {{multiple unsequenced modifications}} + xs[8] ? 0 : ++a + a++; // expected-warning {{multiple unsequenced modifications}} + xs[8] ? ++a : a++; // ok + + xs[8] && (++a + a++); // expected-warning {{multiple unsequenced modifications}} + xs[8] || (++a + a++); // expected-warning {{multiple unsequenced modifications}} } |