mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
40 lines
593 B
Plaintext
40 lines
593 B
Plaintext
|
|
|
|
|
|
struct Struct
|
|
{
|
|
int x;
|
|
}
|
|
|
|
enum Enum : uint
|
|
{
|
|
A, B
|
|
}
|
|
|
|
enum EnumB : char
|
|
{
|
|
C, D
|
|
}
|
|
|
|
typedef func void(Enum) as Func;
|
|
|
|
func void test1(Enum e)
|
|
{
|
|
bool a = cast(e as bool);
|
|
char b = cast(e as char);
|
|
uint c = cast(e as uint);
|
|
float d = cast(e as float);
|
|
uint* f = cast(e as uint*); // #error: cast 'Enum' to 'uint*'
|
|
}
|
|
|
|
func void test2(Enum e)
|
|
{
|
|
Struct* g = cast(e as Struct*); // #error: cast 'Enum' to 'Struct*'
|
|
}
|
|
|
|
func void test3(Enum e)
|
|
{
|
|
EnumB h = cast(e as EnumB);
|
|
Func i = cast(e as Func); // #error: cast 'Enum' to 'Func'
|
|
}
|