mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
40 lines
625 B
Plaintext
40 lines
625 B
Plaintext
struct Foo
|
|
{
|
|
int a;
|
|
float b;
|
|
}
|
|
|
|
struct Bar
|
|
{
|
|
int b;
|
|
float c;
|
|
}
|
|
|
|
struct Baz
|
|
{
|
|
int b;
|
|
int c;
|
|
}
|
|
|
|
struct BazTwo
|
|
{
|
|
int[1] d;
|
|
int e;
|
|
}
|
|
|
|
fn void test()
|
|
{
|
|
Foo x;
|
|
{ Bar y = (Bar)(x); } // #error: 'Foo' to 'Bar'
|
|
|
|
Baz z;
|
|
{ int[2] w = (int[2])(z); } // #error: 'Baz' to 'int[2]'
|
|
int[2] w;
|
|
z = (Baz)(w); // #error: to 'Baz'
|
|
{ BazTwo v = (BazTwo)(z); } // #error: 'Baz' to 'BazTwo'
|
|
BazTwo v;
|
|
v = (BazTwo)(w); // #error: to 'BazTwo'
|
|
z = (Baz)(v); // #error: possible to cast 'BazTwo' to 'Baz'
|
|
w = (int[2])(v); // #error: possible to cast 'BazTwo' to 'int[2]'
|
|
}
|