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 failed when calling function returning struct with type member #586

scurest opened this Issue Nov 5, 2017 · 0 comments


None yet
2 participants

scurest commented Nov 5, 2017

const assert = @import("std").debug.assert;

const Wrapper = struct { T: type };

fn wrap(comptime T: type) -> Wrapper {
    Wrapper { .T = T }

pub fn main() -> %void {
    const ty = wrap(i32).T;
    assert(ty == i32);
    // this works:
    // vvvvvvvvvvv
    //const ty = (Wrapper { .T = i32 }).T;
    //assert(ty == i32);

fails during compilation with

    LLVMOpaqueValue* build_alloca(CodeGen*, TypeTableEntry*, const char*, uint32_t):
    Assertion `alignment > 0' failed.
Aborted (core dumped)

@andrewrk andrewrk added the bug label Nov 5, 2017

@andrewrk andrewrk added this to the 0.2.0 milestone Nov 5, 2017

@andrewrk andrewrk modified the milestones: 0.2.0, 0.3.0 Mar 14, 2018

@andrewrk andrewrk closed this in 31aefa6 Jun 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment