diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-08-30 00:06:14 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-08-30 00:06:14 -0400 |
| commit | b35dad88b474bf346131696f5cb0e01a5b1c45c1 (patch) | |
| tree | 5c233088134826fd9dc9c266b91abb8e0b7b7498 /test/compile_errors.zig | |
| parent | 2d5762235529c6023aa61edac95f123576579a52 (diff) | |
| download | zig-b35dad88b474bf346131696f5cb0e01a5b1c45c1.tar.gz zig-b35dad88b474bf346131696f5cb0e01a5b1c45c1.zip | |
add tests for function alignment handling
See #37
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index e21e56f4e8..e7fddace91 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -2039,4 +2039,16 @@ pub fn addCases(cases: &tests.CompileErrorContext) { \\} , ".tmp_source.zig:2:22: error: expected pointer or slice, found 'u32'"); + + cases.add("passing an under-aligned function pointer", + \\export fn entry() { + \\ testImplicitlyDecreaseFnAlign(alignedSmall, 1234); + \\} + \\fn testImplicitlyDecreaseFnAlign(ptr: fn () align 8 -> i32, answer: i32) { + \\ if (ptr() != answer) unreachable; + \\} + \\fn alignedSmall() align 4 -> i32 { 1234 } + , + ".tmp_source.zig:2:35: error: expected type 'fn() align 8 -> i32', found 'fn() align 4 -> i32'"); + } |
