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

cgen: fix C error with clang, when declaring a fn type with an alias type argument (#10297)

This commit is contained in:
zakuro 2021-06-01 18:37:27 +09:00 committed by GitHub
parent 148bb31f6e
commit 0afeba5588
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -822,9 +822,6 @@ static inline void __${typ.cname}_pushval($typ.cname ch, $el_stype val) {
.map {
g.type_definitions.writeln('typedef map $typ.cname;')
}
.function {
g.write_fn_typesymbol_declaration(typ)
}
else {
continue
}
@ -835,6 +832,11 @@ static inline void __${typ.cname}_pushval($typ.cname ch, $el_stype val) {
g.write_alias_typesymbol_declaration(typ)
}
}
for typ in g.table.type_symbols {
if typ.kind == .function && typ.name !in c.builtins {
g.write_fn_typesymbol_declaration(typ)
}
}
// Generating interfaces after all the common types have been defined
// to prevent generating interface struct before definition of field types
for typ in g.table.type_symbols {

View File

@ -44,6 +44,9 @@ type F6 = fn (int, int)
type F7 = fn (time.Time, int)
type MyTime = time.Time
type F8 = fn (MyTime)
fn C.atoi(&byte) int
fn C.freec(ptr voidptr)