diff options
| author | Bogdan Romanyuk <65823030+wrongnull@users.noreply.github.com> | 2023-10-17 23:05:55 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-17 20:05:55 +0000 |
| commit | ad168db727a1baec8b8efe0bb4418d0df7e84769 (patch) | |
| tree | 4e1eea7d3dd70e18201d4111fa3bffed61a7356a /test/cases/compile_errors | |
| parent | 5c8912d7a445cbafba92913bdd364f9f02d18d87 (diff) | |
| download | zig-ad168db727a1baec8b8efe0bb4418d0df7e84769.tar.gz zig-ad168db727a1baec8b8efe0bb4418d0df7e84769.zip | |
Sema: disallow `@intFromPtr` for comptime-only types
Diffstat (limited to 'test/cases/compile_errors')
| -rw-r--r-- | test/cases/compile_errors/@intFromPtr_with_bad_type.zig | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/cases/compile_errors/@intFromPtr_with_bad_type.zig b/test/cases/compile_errors/@intFromPtr_with_bad_type.zig new file mode 100644 index 0000000000..2899d08348 --- /dev/null +++ b/test/cases/compile_errors/@intFromPtr_with_bad_type.zig @@ -0,0 +1,11 @@ +const x = 42; +const y = @intFromPtr(&x); +pub export fn entry() void { + _ = y; +} + +// error +// backend=stage2 +// target=native +// +// :2:23: error: comptime-only type 'comptime_int' has no pointer address |
