summaryrefslogtreecommitdiffstats
path: root/tests/ui/union/union-repr-c.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/union/union-repr-c.rs')
-rw-r--r--tests/ui/union/union-repr-c.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/union/union-repr-c.rs b/tests/ui/union/union-repr-c.rs
new file mode 100644
index 000000000..1367835e6
--- /dev/null
+++ b/tests/ui/union/union-repr-c.rs
@@ -0,0 +1,18 @@
+#![allow(unused)]
+#![deny(improper_ctypes)]
+
+#[repr(C)]
+union U {
+ a: u8,
+}
+
+union W {
+ a: u8,
+}
+
+extern "C" {
+ static FOREIGN1: U; // OK
+ static FOREIGN2: W; //~ ERROR `extern` block uses type `W`
+}
+
+fn main() {}