summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-12-17 21:57:17 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-12-17 21:57:17 +0000
commit6c93b3e29c56d14eab570ce62cd646a95f0c1403 (patch)
tree69fbc580587cf8545f536f5fda9b6663791920a5 /clang/test/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
parent4de56ef736fedb64d059fa6a922abd10b5f18690 (diff)
downloadbcm5719-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/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp')
-rw-r--r--clang/test/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
index 03147a692dd..d791ed60cfc 100644
--- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
+++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
@@ -18,7 +18,7 @@ void unevaluated_operand(P &p, int i) { //expected-note{{declared here}}
// FIXME: this should only emit one error.
int i2 = sizeof([](auto a, auto b)->void{}(3, '4')); // expected-error{{lambda expression in an unevaluated operand}} \
// expected-error{{invalid application of 'sizeof'}}
- const std::type_info &ti1 = typeid([](auto &a) -> P& { static P p; return p; }(i));
+ const std::type_info &ti1 = typeid([](auto &a) -> P& { static P p; return p; }(i)); // expected-warning {{expression with side effects will be evaluated despite being used as an operand to 'typeid'}}
const std::type_info &ti2 = typeid([](auto) -> int { return i; }(i)); // expected-error{{lambda expression in an unevaluated operand}}\
// expected-error{{cannot be implicitly captured}}\
// expected-note{{begins here}}
OpenPOWER on IntegriCloud