mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
38 lines
537 B
Plaintext
38 lines
537 B
Plaintext
struct Struct
|
|
{
|
|
int x;
|
|
}
|
|
|
|
enum Enum : uint
|
|
{
|
|
A, B
|
|
}
|
|
|
|
enum EnumB : char
|
|
{
|
|
C, D
|
|
}
|
|
|
|
alias Func = fn void(Enum);
|
|
|
|
fn void test1(Enum e)
|
|
{
|
|
bool a = (bool)e;
|
|
char b = (char)e.ordinal;
|
|
uint c = (uint)e.ordinal;
|
|
float d = (float)e; // #error: float
|
|
uint* f = (uint*)e; // #error: 'uint*'
|
|
}
|
|
|
|
fn void test2(Enum e)
|
|
{
|
|
Struct* g = (Struct*)(e); // #error: 'Struct*'
|
|
}
|
|
|
|
fn void test3(Enum e)
|
|
{
|
|
EnumB h = (EnumB)(e); // #error: 'EnumB'
|
|
Func i = (Func)(e); // #error: 'Func'
|
|
}
|
|
|