- $typeof untyped list crashes when trying to create typeid from it. #2779

This commit is contained in:
Christoffer Lerno
2026-01-20 17:54:05 +01:00
parent d7bfddf35e
commit 888657cc97
3 changed files with 6 additions and 1 deletions

View File

@@ -23,6 +23,7 @@
- Vectors not converted to arrays when passed as raw vaargs. #2776
- Second value in switch range not checked properly, causing an error on non-const values. #2777
- Broken cast from fault to array pointer #2778.
- $typeof untyped list crashes when trying to create typeid from it. #2779
### Fixes
- Regression with npot vector in struct triggering an assert #2219.

View File

@@ -4247,7 +4247,6 @@ INLINE void expr_rewrite_const_slice(Expr *expr, Type *type, ConstInitializer *i
INLINE void expr_rewrite_const_typeid(Expr *expr, Type *type)
{
ASSERT(type->type_kind != TYPE_UNTYPED_LIST);
expr->expr_kind = EXPR_CONST;
expr->const_expr.const_kind = CONST_TYPEID;
expr->const_expr.typeid = type->canonical;

View File

@@ -0,0 +1,5 @@
fn void a()
{
typeid a = $typeof({}); // #error: You cannot take the typeid of a compile time type
var t @safeinfer = mem::new_array($typeof({}), 1); // #error: 'untyped_list' does not have a property or method 'alignof'
}