about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2022-08-26 11:04:13 -0400
committerRalf Jung <post@ralfj.de>2022-08-26 11:04:13 -0400
commit468c617c2124b0b50eedab634656d213fc1e033d (patch)
tree363b8f72a37cec6de80506d0d72c082a8c7e96ac
parentb85178a5fccb0d582fdbf23625c531af170cc882 (diff)
downloadrust-468c617c2124b0b50eedab634656d213fc1e033d.tar.gz
rust-468c617c2124b0b50eedab634656d213fc1e033d.zip
add a test
-rw-r--r--src/test/ui/consts/extra-const-ub/issue-101034.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/ui/consts/extra-const-ub/issue-101034.rs b/src/test/ui/consts/extra-const-ub/issue-101034.rs
new file mode 100644
index 00000000000..e0de705c488
--- /dev/null
+++ b/src/test/ui/consts/extra-const-ub/issue-101034.rs
@@ -0,0 +1,17 @@
+// check-pass
+// compile-flags: -Zextra-const-ub-checks
+
+#[repr(packed)]
+pub struct Foo {
+    bar: u8,
+    baa: [u32; 1],
+}
+
+const FOOMP: Foo = Foo {
+    bar: 0,
+    baa: [69; 1],
+};
+
+fn main() {
+    let _val = FOOMP;
+}