Taking .ordinal from an enum passed by pointer and then taking the address of this result would return the enum, not int.

This commit is contained in:
Christoffer Lerno
2025-09-18 14:04:49 +02:00
parent c5e3a1b2da
commit fdc20dc642
4 changed files with 44 additions and 21 deletions

View File

@@ -0,0 +1,18 @@
import std::io;
enum Foo
{
A,
B,
}
fn void Foo.hello(&self)
{
io::printf("%d\n", self.ordinal);
}
fn void main()
{
Foo x = B;
x.hello();
}