Browse Source

Allow `check_expr_with_type_hint` to allow assignment of types to typeid without requiring `typeid_of`

gingerBill 4 years ago
parent
commit
720f2c7c61
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/check_expr.cpp

+ 3 - 1
src/check_expr.cpp

@@ -7910,7 +7910,9 @@ void check_expr_with_type_hint(CheckerContext *c, Operand *o, Ast *e, Type *t) {
 		err_str = "used as a value";
 		break;
 	case Addressing_Type:
-		err_str = "is not an expression but a type";
+		if (t == nullptr || !is_type_typeid(t)) {
+			err_str = "is not an expression but a type";
+		}
 		break;
 	case Addressing_Builtin:
 		err_str = "must be called";