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:
parent
add4d391cb
commit
d7c63922d5
@ -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)
|
||||
}
|
||||
}
|
||||
|
1
vlib/v/tests/inout/c_fn_can_return_void_type.out
Normal file
1
vlib/v/tests/inout/c_fn_can_return_void_type.out
Normal file
@ -0,0 +1 @@
|
||||
ok
|
4
vlib/v/tests/inout/c_fn_can_return_void_type.vv
Normal file
4
vlib/v/tests/inout/c_fn_can_return_void_type.vv
Normal file
@ -0,0 +1,4 @@
|
||||
fn C.some_c_function(int) void
|
||||
fn main() {
|
||||
println('ok')
|
||||
}
|
Loading…
Reference in New Issue
Block a user