mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Merge pull request #2019 from jaspergeer/fix-ternary-if-type-operands
fix panic when typeid used as operand for ternary if expression
This commit is contained in:
@@ -7359,6 +7359,14 @@ ExprKind check_ternary_if_expr(CheckerContext *c, Operand *o, Ast *node, Type *t
|
|||||||
return kind;
|
return kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (x.mode == Addressing_Type || y.mode == Addressing_Type) {
|
||||||
|
Ast *type_expr = (x.mode == Addressing_Type) ? x.expr : y.expr;
|
||||||
|
gbString type_string = expr_to_string(type_expr);
|
||||||
|
error(node, "Type %s is invalid operand for ternary if expression", type_string);
|
||||||
|
gb_string_free(type_string);
|
||||||
|
return kind;
|
||||||
|
}
|
||||||
|
|
||||||
if (x.type == nullptr || x.type == t_invalid ||
|
if (x.type == nullptr || x.type == t_invalid ||
|
||||||
y.type == nullptr || y.type == t_invalid) {
|
y.type == nullptr || y.type == t_invalid) {
|
||||||
return kind;
|
return kind;
|
||||||
|
|||||||
Reference in New Issue
Block a user