diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2014-12-17 21:57:17 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2014-12-17 21:57:17 +0000 |
commit | 6c93b3e29c56d14eab570ce62cd646a95f0c1403 (patch) | |
tree | 69fbc580587cf8545f536f5fda9b6663791920a5 /clang/test/Sema/expr-comma.c | |
parent | 4de56ef736fedb64d059fa6a922abd10b5f18690 (diff) | |
download | bcm5719-llvm-6c93b3e29c56d14eab570ce62cd646a95f0c1403.tar.gz bcm5719-llvm-6c93b3e29c56d14eab570ce62cd646a95f0c1403.zip |
Adding a -Wunused-value warning for expressions with side effects used in an unevaluated expression context, such as sizeof(), or decltype(). Also adds a similar warning when the expression passed to typeid() *is* evaluated, since it is equally likely that the user would expect the expression operand to be unevaluated in that case.
llvm-svn: 224465
Diffstat (limited to 'clang/test/Sema/expr-comma.c')
-rw-r--r-- | clang/test/Sema/expr-comma.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/test/Sema/expr-comma.c b/clang/test/Sema/expr-comma.c index e2beafe236c..04e57dec3ac 100644 --- a/clang/test/Sema/expr-comma.c +++ b/clang/test/Sema/expr-comma.c @@ -1,5 +1,4 @@ // RUN: %clang_cc1 %s -fsyntax-only -verify -std=c89 -Wno-sizeof-array-decay -// expected-no-diagnostics // rdar://6095180 struct s { char c[17]; }; @@ -15,4 +14,4 @@ int B[sizeof((a.c)) == 17 ? 1 : -1]; int W[sizeof(0, a.c) == sizeof(char*) ? 1 : -1]; int X[sizeof(0, (foo().c)) == 17 ? 1 : -1]; int Y[sizeof(0, (a,b).c) == 17 ? 1 : -1]; -int Z[sizeof(0, (a=b).c) == 17 ? 1 : -1]; +int Z[sizeof(0, (a=b).c) == 17 ? 1 : -1]; // expected-warning {{expression with side effects has no effect in an unevaluated context}} |