Odin » Forums » Assertion Failure: `tav.mode != Addressing_Invalid` 0 <no type>
drifter
1 posts
#16926 Assertion Failure: `tav.mode != Addressing_Invalid` 0 <no type>
6 days, 22 hours ago Edited by drifter on Dec. 7, 2018, 2:14 a.m.

Hi there,

I've been eyeing Odin for a number of years and now giving it a try.

I'm following the book "Writing an Interpreter in Go".

Basically what I'm trying to do is define a struct, and a function that will initialize it.

// :lexer
Lexer :: struct {
input: string,
position: int,
readPosition: int,
char: byte,
}

// "Constructor"
new_lexer :: proc(input: string) -> Lexer {
return Lexer{input, position=0, readPosition=0, char='0'};
}


// Main
main :: proc() {
l: Lexer;
l = new_lexer("Hello world");
fmt.println(l.input);
}


But I get the following error, which I'm sure is due to my ignorance.

src/ir.cpp(6606): Assertion Failure: `tav.mode != Addressing_Invalid` 0 <no type>
Illegal instruction (core dumped)

If anyone could help point out where I went wrong it would be great.

Regards,

yc