mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-27 20:18:01 +02:00
Fixed enum casting with implicit 'int' operator
This commit is contained in:
parent
33e4ac7a95
commit
06c5e06a58
2 changed files with 18 additions and 3 deletions
|
@ -109,6 +109,15 @@ namespace Tests
|
|||
public static int operator implicit(Self self);
|
||||
}
|
||||
|
||||
public enum EnumM
|
||||
{
|
||||
public static implicit operator int(Self self);
|
||||
|
||||
case A;
|
||||
case B;
|
||||
case C;
|
||||
}
|
||||
|
||||
[Test]
|
||||
static void TestBasic()
|
||||
{
|
||||
|
@ -118,6 +127,13 @@ namespace Tests
|
|||
Test.Assert(sizeof(EnumB) == 2);
|
||||
Test.Assert(sizeof(EnumC) == 4);
|
||||
Test.Assert(sizeof(EnumD) == 8);
|
||||
|
||||
EnumM em = ?;
|
||||
int i = em;
|
||||
uint u = (uint)em;
|
||||
|
||||
i = 123;
|
||||
EnumA e = (EnumA)i;
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue