Commit 182a9db2 authored by Ian Lance Taylor's avatar Ian Lance Taylor Committed by Russ Cox

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: 's avatarMichael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
parent 4760b5a4
......@@ -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
......
// 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))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment