Skip to content

Commit 7bdd0a8

Browse files
committed
Allow for CONSTANT_TYPEID_ARRAY[idx] to be used as a type in certain contexts
1 parent 27bd72c commit 7bdd0a8

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/check_type.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3750,6 +3750,20 @@ gb_internal bool check_type_internal(CheckerContext *ctx, Ast *e, Type **type, T
37503750
set_base_type(named_type, *type);
37513751
return true;
37523752
case_end;
3753+
3754+
default: {
3755+
Operand o = {};
3756+
check_expr_base(ctx, &o, e, nullptr);
3757+
3758+
if (o.mode == Addressing_Constant &&
3759+
o.value.kind == ExactValue_Typeid) {
3760+
Type *t = o.value.value_typeid;
3761+
if (t != nullptr && t != t_invalid) {
3762+
*type = t;
3763+
return true;
3764+
}
3765+
}
3766+
}
37533767
}
37543768

37553769
*type = t_invalid;

0 commit comments

Comments
 (0)