mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Change cast and int rules: constant folding always starts. Promotion using left side on all operands to bit width. Implicit narrowing to max size on right hand side.
This commit is contained in:
committed by
Christoffer Lerno
parent
8a7f37e4d3
commit
07595df412
@@ -1,20 +1,20 @@
|
||||
const char AA = ~0;
|
||||
const char AA = ~cast(0 as char);
|
||||
const char BB = 200 ;
|
||||
const uint CC = ~0;
|
||||
const uint CC = ~cast(0 as uint);
|
||||
const uint DD = FOO;
|
||||
|
||||
const FOO = ~0;
|
||||
const FOO = ~cast(0 as uint);
|
||||
|
||||
uint x = AA;
|
||||
uint z = CC;
|
||||
char w = FOO;
|
||||
ushort v = FOO;
|
||||
char w = cast(FOO as char);
|
||||
ushort v = cast(FOO as ushort);
|
||||
uint z2 = DD;
|
||||
|
||||
func void test()
|
||||
{
|
||||
int xx = FOO;
|
||||
int* yy = &&FOO;
|
||||
uint* yy = &&FOO;
|
||||
}
|
||||
|
||||
// #expect: constants.ll
|
||||
|
||||
Reference in New Issue
Block a user