From 871fb3831aeaded72d8571550fb5f5a36ecbe131 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 5 Jul 2019 22:03:00 +0200 Subject: [PATCH] do not allow fn main() to return a value --- compiler/fn.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/fn.v b/compiler/fn.v index 7e761640f2..48297bb09e 100644 --- a/compiler/fn.v +++ b/compiler/fn.v @@ -261,7 +261,7 @@ fn (p mut Parser) fn_decl() { // println('FN DECL $f.name typ=$f.typ str_args="$str_args"') // Special case for main() args if f.name == 'main' && !has_receiver { - if str_args != '' { + if str_args != '' || typ != 'void' { p.error('fn main must have no arguments and no return values') } typ = 'int'