Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Dec 15, 2024
1 parent 3d5f81b commit 60fbdc4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion vlib/v/gen/c/fn.v
Original file line number Diff line number Diff line change
Expand Up @@ -2180,7 +2180,7 @@ fn (mut g Gen) fn_call(node ast.CallExpr) {
// Skip "C."
name = util.no_dots(name[2..])
} else {
name = c_fn_name(name)
name = if is_selector_call { c_name(name) } else { c_fn_name(name) }
}
if g.pref.translated || g.file.is_translated || node.is_file_translated {
// For `@[c: 'P_TryMove'] fn p_trymove( ... `
Expand Down
21 changes: 21 additions & 0 deletions vlib/v/tests/selector_call_with_reserved_c_name_test.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
struct Foo {
}

struct Bar {
do fn () bool = unsafe { nil }
}

fn (f Foo) get() Bar {
return Bar{
do: foobar
}
}

fn foobar() bool {
return true
}

fn test_main() {
t := Foo{}
assert t.get().do() == true
}

0 comments on commit 60fbdc4

Please sign in to comment.