summaryrefslogtreecommitdiffstats
path: root/src/test/ui/assoc-oddities-3.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/assoc-oddities-3.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/ui/assoc-oddities-3.rs b/src/test/ui/assoc-oddities-3.rs
new file mode 100644
index 000000000..cd025dc8b
--- /dev/null
+++ b/src/test/ui/assoc-oddities-3.rs
@@ -0,0 +1,13 @@
+// run-pass
+
+fn that_odd_parse(c: bool, n: usize) -> u32 {
+ let x = 2;
+ let a = [1, 2, 3, 4];
+ let b = [5, 6, 7, 7];
+ x + if c { a } else { b }[n]
+}
+
+fn main() {
+ assert_eq!(4, that_odd_parse(true, 1));
+ assert_eq!(8, that_odd_parse(false, 1));
+}