summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-14865.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/issues/issue-14865.rs')
-rw-r--r--tests/ui/issues/issue-14865.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/ui/issues/issue-14865.rs b/tests/ui/issues/issue-14865.rs
new file mode 100644
index 000000000..56e78e78f
--- /dev/null
+++ b/tests/ui/issues/issue-14865.rs
@@ -0,0 +1,23 @@
+// run-pass
+#![allow(dead_code)]
+
+enum X {
+ Foo(usize),
+ Bar(bool)
+}
+
+fn main() {
+ let x = match X::Foo(42) {
+ X::Foo(..) => 1,
+ _ if true => 0,
+ X::Bar(..) => panic!("Oh dear")
+ };
+ assert_eq!(x, 1);
+
+ let x = match X::Foo(42) {
+ _ if true => 0,
+ X::Foo(..) => 1,
+ X::Bar(..) => panic!("Oh dear")
+ };
+ assert_eq!(x, 0);
+}