aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/unused-expr.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-08-31 21:49:55 +0000
committerChris Lattner <sabre@nondot.org>2007-08-31 21:49:55 +0000
commit98414c1b7d1944a57156d52e29bd41c005de09ac (patch)
tree47fbed1c7e597bc7a962919e8e1fa44bff614ba3 /test/Sema/unused-expr.c
parent805e9a8300af9489ec13cd804c070267b7c4cfec (diff)
Fix a bug/missing-feature Ted noticed: the 'unused' warning should not
warn about the last stmt in a stmtexpr, f.e. there should be no warning for: int maxval_stmt_expr(int x, int y) { return ({int _a = x, _b = y; _a > _b ? _a : _b; }); } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41655 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/unused-expr.c')
-rw-r--r--test/Sema/unused-expr.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/Sema/unused-expr.c b/test/Sema/unused-expr.c
index da3a21fcdd..e9e2992d0a 100644
--- a/test/Sema/unused-expr.c
+++ b/test/Sema/unused-expr.c
@@ -30,3 +30,8 @@ void t3(int c) {
c ? t1() : t2();
}
+// This shouldn't warn: the expr at the end of the stmtexpr really is used.
+int stmt_expr(int x, int y) {
+ return ({int _a = x, _b = y; _a > _b ? _a : _b; });
+}
+