mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
Compiler segfault when using bitwise not on number literal cast to bitstruct #2373.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
- Compiler assert when using generic parameters list without any parameters. #2369
|
||||
- Parsing difference between "0x00." and "0X00." literals #2371
|
||||
- Fixed bug generating `$c += 1` when `$c` was derived from a pointer but behind a cast.
|
||||
- Compiler segfault when using bitwise not on number literal cast to bitstruct #2373.
|
||||
|
||||
### Stdlib changes
|
||||
- Add `==` to `Pair`, `Triple` and TzDateTime. Add print to `Pair` and `Triple`.
|
||||
|
||||
@@ -8575,7 +8575,7 @@ static inline bool sema_expr_analyse_bit_not(SemaContext *context, Expr *expr, b
|
||||
}
|
||||
|
||||
VALID_VEC:
|
||||
if (is_bitstruct && sema_cast_const(inner))
|
||||
if (is_bitstruct && sema_cast_const(inner) && expr_is_const_initializer(inner))
|
||||
{
|
||||
expr_replace(expr, inner);
|
||||
sema_invert_bitstruct_const_initializer(expr->const_expr.initializer);
|
||||
|
||||
12
test/test_suite/bitstruct/bitstruct_negate_cast.c3t
Normal file
12
test/test_suite/bitstruct/bitstruct_negate_cast.c3t
Normal file
@@ -0,0 +1,12 @@
|
||||
// #target: macos-x64
|
||||
module test;
|
||||
bitstruct Foo : uint
|
||||
{
|
||||
bool test : 2;
|
||||
}
|
||||
|
||||
fn int main()
|
||||
{
|
||||
~(Foo)2;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user