aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-02-14 19:53:46 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-02-14 20:02:29 -0500
commitcc7060d0d934135d797bd2bc24288ecab095051a (patch)
treef7a94569505fe31bd71bb0b61ff4c20bbcdbf3f8 /test/compile_errors.zig
parent973a93d43b8b44d2ee8bfde09e78f8295470f337 (diff)
downloadzig-cc7060d0d934135d797bd2bc24288ecab095051a.tar.gz
zig-cc7060d0d934135d797bd2bc24288ecab095051a.zip
compile error for C pointer with align attribute
See #1059
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 5e9b691641..ab9eda3f15 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -118,13 +118,17 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
);
cases.addTest(
- "C pointer pointing to non C ABI compatible type",
+ "C pointer pointing to non C ABI compatible type or has align attr",
\\const Foo = struct {};
- \\export fn entry() [*c]Foo {
- \\ return undefined;
+ \\export fn a() void {
+ \\ const T = [*c]Foo;
+ \\}
+ \\export fn b() void {
+ \\ const T = [*c]align(4) u8;
\\}
,
- ".tmp_source.zig:2:19: error: C pointers cannot point to non-C-ABI-compatible type 'Foo'",
+ ".tmp_source.zig:3:15: error: C pointers cannot point to non-C-ABI-compatible type 'Foo'",
+ ".tmp_source.zig:6:15: error: [*c] pointers may not have align attribute",
);
cases.addTest(