mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Some refactoring of the bitstruct representation. Correctly represent inner types. #1471
This commit is contained in:
21
test/test_suite/cast/inner_type_cast.c3
Normal file
21
test/test_suite/cast/inner_type_cast.c3
Normal file
@@ -0,0 +1,21 @@
|
||||
module test;
|
||||
|
||||
struct Foo
|
||||
{
|
||||
bitstruct abc : int
|
||||
{
|
||||
bool a;
|
||||
}
|
||||
}
|
||||
|
||||
fn void test1()
|
||||
{
|
||||
Foo x;
|
||||
x.abc = "abc"; // #error: to the inner type 'Foo.abc'
|
||||
}
|
||||
|
||||
fn void test2()
|
||||
{
|
||||
Foo x;
|
||||
x.abc = 2; // #error: type 'Foo.abc' is not permitted, but you may do an explicit
|
||||
}
|
||||
@@ -71,7 +71,7 @@ struct Aa1
|
||||
fn void test_conversion_struct()
|
||||
{
|
||||
Aa1 a1;
|
||||
int aa = a1.bb; // #error: 'bb' to 'int'
|
||||
int aa = a1.bb; // #error: 'Aa1.bb' to 'int'
|
||||
}
|
||||
|
||||
struct Struct
|
||||
|
||||
Reference in New Issue
Block a user