diff options
Diffstat (limited to 'tests/ui/consts/extra-const-ub/issue-100771.rs')
-rw-r--r-- | tests/ui/consts/extra-const-ub/issue-100771.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/ui/consts/extra-const-ub/issue-100771.rs b/tests/ui/consts/extra-const-ub/issue-100771.rs new file mode 100644 index 000000000..a32960328 --- /dev/null +++ b/tests/ui/consts/extra-const-ub/issue-100771.rs @@ -0,0 +1,20 @@ +// check-pass +// compile-flags: -Zextra-const-ub-checks + +#[derive(PartialEq, Eq, Copy, Clone)] +#[repr(packed)] +struct Foo { + field: (i64, u32, u32, u32), +} + +const FOO: Foo = Foo { + field: (5, 6, 7, 8), +}; + +fn main() { + match FOO { + Foo { field: (5, 6, 7, 8) } => {}, + FOO => unreachable!(), + _ => unreachable!(), + } +} |