Selaa lähdekoodia

Check for variadic param default val

jakubtomsu 1 vuosi sitten
vanhempi
commit
3c25d93eae
1 muutettua tiedostoa jossa 3 lisäystä ja 1 poistoa
  1. 3 1
      src/check_type.cpp

+ 3 - 1
src/check_type.cpp

@@ -1510,8 +1510,10 @@ gb_internal Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_para
 			}
 
 			if (default_value != nullptr) {
-				if (type_expr != nullptr && type_expr->kind == Ast_TypeidType) {
+				if (type_expr->kind == Ast_TypeidType) {
 					error(type_expr, "A type parameter may not have a default value");
+				} else if (is_variadic) {
+					error(type_expr, "A variadic parameter may not have a default value");
 				} else {
 					param_value = handle_parameter_value(ctx, type, nullptr, default_value, true);
 				}