mirror of https://github.com/golang/go.git
cmd/vet: don't crash in cgo checker if type is unknown
Fixes #14201. Change-Id: Ib61f8c00cae72463f59b90ae199fbdc1e7422a79 Reviewed-on: https://go-review.googlesource.com/19174 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
4760b5a478
commit
182a9db2dc
|
|
@ -72,6 +72,9 @@ func cgoBaseType(f *File, arg ast.Expr) types.Type {
|
|||
}
|
||||
// Here arg is *f(v).
|
||||
t := f.pkg.types[call.Fun].Type
|
||||
if t == nil {
|
||||
break
|
||||
}
|
||||
ptr, ok := t.Underlying().(*types.Pointer)
|
||||
if !ok {
|
||||
break
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Test the cgo checker on a file that doesn't use cgo.
|
||||
|
||||
package testdata
|
||||
|
||||
var _ = C.f(*p(**p))
|
||||
Loading…
Reference in New Issue