Files
c3c/test/test_suite/cast/cast_struct_fails.c3

35 lines
369 B
Plaintext

struct Foo
{
int a;
float b;
}
struct Bar
{
int b;
float c;
}
struct Baz
{
int b;
int c;
}
struct BazTwo
{
int[2] d;
int e;
}
func void test1()
{
Foo x;
Bar z = cast(x as Baz); // #error: Cannot cast 'Foo' to 'Baz'
}
func void test2()
{
Baz x;
BazTwo z = cast(x as BazTwo); // #error: Cannot cast 'Baz' to 'BazTwo'
}