aboutsummaryrefslogtreecommitdiff
path: root/test/conditional-compound-literal.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2021-09-28 17:35:46 -0700
committerMichael Forney <mforney@mforney.org>2021-09-28 17:39:59 -0700
commite196f1607a9f07198653431681617a601edc07f3 (patch)
treea60f64f7ae58f0acba64b263bd1ed3496eb02c0d /test/conditional-compound-literal.c
parentf4161c24d903fd4ecfd130d00fb410ef7b70eb16 (diff)
expr: Skip codegen for unused expression in conditional with constant expression
This compiles `0 ? e1 : e2` as `e2`, and `1 ? e1 : e2` as `e1` (while still adjusting the type as necessary).
Diffstat (limited to 'test/conditional-compound-literal.c')
-rw-r--r--test/conditional-compound-literal.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/conditional-compound-literal.c b/test/conditional-compound-literal.c
index 33a5416..40b8ad6 100644
--- a/test/conditional-compound-literal.c
+++ b/test/conditional-compound-literal.c
@@ -1,4 +1,4 @@
int main(void) {
- int x = 0, *p = 0 ? 0 : &(int){x};
+ int x = 0, *p = x ? 0 : &(int){x};
return *p;
}