Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assertion failure in comptime block #547

Closed
PavelVozenilek opened this issue Oct 19, 2017 · 3 comments
Closed

assertion failure in comptime block #547

PavelVozenilek opened this issue Oct 19, 2017 · 3 comments
Labels
bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@PavelVozenilek
Copy link

This little program crashes the compiler:

const io = @import("std").io;

pub fn main() -> %void {
  const  x  = undefined; /// <<<=== probably this line
  %%io.stdout.printf("{}\n", @typeName(@typeOf(x)));
}

@tiehuis tiehuis added the bug Observed behavior contradicts documented or intended behavior label Oct 19, 2017
@andrewrk andrewrk added this to the 0.2.0 milestone Oct 19, 2017
@PavelVozenilek
Copy link
Author

Yet another compiler crash:

const io = @import("std").io;

pub fn main() -> %void {

const x = comptime {
  var i : i32 = 99;
  i += 1;
  i; // <<== the ; here does it
};
  %%io.stdout.printf("{}\n", x);
}

@andrewrk
Copy link
Member

I fixed the first one. These are separate issues.

@andrewrk andrewrk changed the title 0.1.1: compiler crash assertion failure in comptime block Oct 21, 2017
@andrewrk
Copy link
Member

see #557

If we didn't have the crash from the void value you would have got this error:

/home/andy/dev/zig/build/test.zig:8:3: error: expression value is ignored
  i; // <<== the ; here does it
  ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

3 participants