diff --git a/releasenotes.md b/releasenotes.md index 6679cb16e..9a2866c3e 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -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. diff --git a/src/compiler/compiler_internal.h b/src/compiler/compiler_internal.h index d92c40b0e..8828ee8d9 100644 --- a/src/compiler/compiler_internal.h +++ b/src/compiler/compiler_internal.h @@ -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; diff --git a/test/test_suite/compile_time_introspection/typeof_untyped_list.c3 b/test/test_suite/compile_time_introspection/typeof_untyped_list.c3 new file mode 100644 index 000000000..44f761a22 --- /dev/null +++ b/test/test_suite/compile_time_introspection/typeof_untyped_list.c3 @@ -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' +} \ No newline at end of file