1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

parser: allow void return type for C functions

This commit is contained in:
Swastik Baranwal 2020-06-07 22:15:27 +05:30 committed by GitHub
parent add4d391cb
commit d7c63922d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -136,7 +136,7 @@ pub fn (mut p Parser) parse_type() table.Type {
if p.tok.kind != .lcbr {
pos := p.tok.position()
typ = p.parse_any_type(language, nr_muls > 0)
if typ == table.void_type {
if typ == table.void_type && is_optional {
p.error_with_pos('use `?` instead of `?void`', pos)
}
}

View File

@ -0,0 +1 @@
ok

View File

@ -0,0 +1,4 @@
fn C.some_c_function(int) void
fn main() {
println('ok')
}