mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/cgo: fail on v, err := C.fn when fn is a builtin function
We were already checking for _CMalloc, but in fact none of the builtin functions support returning an error. Fixes #67707 Change-Id: I0ee432a9f13ace472c3f36f641efc7d18eda0631 Reviewed-on: https://go-review.googlesource.com/c/go/+/589575 Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
1b4f1dc95d
commit
d73a8a206a
3 changed files with 18 additions and 2 deletions
|
|
@ -1601,8 +1601,8 @@ func (p *Package) rewriteName(f *File, r *Ref, addPosition bool) ast.Expr {
|
|||
break
|
||||
}
|
||||
if r.Context == ctxCall2 {
|
||||
if r.Name.Go == "_CMalloc" {
|
||||
error_(r.Pos(), "no two-result form for C.malloc")
|
||||
if builtinDefs[r.Name.Go] != "" {
|
||||
error_(r.Pos(), "no two-result form for C.%s", r.Name.Go)
|
||||
break
|
||||
}
|
||||
// Invent new Name for the two-result function.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue