aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/cases/export_from_body_of_coerced_fn.zig19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/cases/export_from_body_of_coerced_fn.zig b/test/cases/export_from_body_of_coerced_fn.zig
new file mode 100644
index 0000000000..541cd0c86f
--- /dev/null
+++ b/test/cases/export_from_body_of_coerced_fn.zig
@@ -0,0 +1,19 @@
+fn original() usize {
+ _ = struct {
+ export const val: u32 = 123;
+ };
+ return 0;
+}
+
+pub fn main() void {
+ const coerced: fn () u64 = original;
+ _ = coerced();
+
+ const S = struct {
+ extern const val: u32;
+ };
+ if (S.val != 123) @panic("wrong value");
+}
+
+// run
+// target=x86_64-linux