mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Ignore const null check on deref in $defined and $sizeof #2633.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
- Optional does not play well with bit ops #2618.
|
||||
- `Bytebuffer.grow` was broken #2622.
|
||||
- Hex escapes like `"\x80"` would be incorrectly lowered. #2623
|
||||
- Ignore const null check on deref in `$defined` and `$sizeof` #2633.
|
||||
|
||||
### Stdlib changes
|
||||
- Add `ThreadPool` join function to wait for all threads to finish in the pool without destroying the threads.
|
||||
|
||||
@@ -6085,7 +6085,7 @@ TYPE_CALL:
|
||||
|
||||
bool sema_expr_rewrite_insert_deref(SemaContext *context, Expr *original)
|
||||
{
|
||||
if (expr_is_const_pointer(original) && !original->const_expr.ptr)
|
||||
if (expr_is_const_pointer(original) && !original->const_expr.ptr && !context->call_env.in_no_eval)
|
||||
{
|
||||
RETURN_SEMA_ERROR(original, "This value is known to be null so you cannot dereference it.");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
module test;
|
||||
import std;
|
||||
|
||||
fn int main()
|
||||
{
|
||||
int x @if($defined((char*){}.is_digit()));
|
||||
isz s = $sizeof((char*){}.is_digit());
|
||||
$typeof((char*){}.is_digit()) t;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user