mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
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:
18
test/test_suite/enumerations/enum_to_ordinal.c3
Normal file
18
test/test_suite/enumerations/enum_to_ordinal.c3
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user