summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/AST/Expr.cpp4
-rw-r--r--clang/test/Sema/unused-expr.c5
2 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index cd495bc63e4..e327ffb9117 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -336,6 +336,10 @@ bool Expr::hasLocalSideEffect() const {
return cast<CastExpr>(this)->getSubExpr()->hasLocalSideEffect();
return false;
+ case ImplicitCastExprClass:
+ // Check the operand, since implicit casts are inserted by Sema
+ return cast<ImplicitCastExpr>(this)->getSubExpr()->hasLocalSideEffect();
+
case CXXDefaultArgExprClass:
return cast<CXXDefaultArgExpr>(this)->getExpr()->hasLocalSideEffect();
}
diff --git a/clang/test/Sema/unused-expr.c b/clang/test/Sema/unused-expr.c
index 305c2be06b5..b14daa702dd 100644
--- a/clang/test/Sema/unused-expr.c
+++ b/clang/test/Sema/unused-expr.c
@@ -35,3 +35,8 @@ int stmt_expr(int x, int y) {
return ({int _a = x, _b = y; _a > _b ? _a : _b; });
}
+void nowarn(unsigned char* a, unsigned char* b)
+{
+ unsigned char c = 1;
+ *a |= c, *b += c;
+}
OpenPOWER on IntegriCloud