mirror of
https://github.com/golang/go
synced 2024-11-23 15:20:03 -07:00
9c258c6aa6
cgo panics in Package.rewriteRef for: var a = C.enum_test(1) or p := new(C.enum_test) when the corresponding enum type is not defined. Check nil values for Type fields and issue a proper error instead. Fixes #11097 Updates #12160 Change-Id: I5821d29097ef0a36076ec5273125b09846c7d832 Reviewed-on: https://go-review.googlesource.com/15264 Reviewed-by: Ian Lance Taylor <iant@golang.org>
16 lines
280 B
Go
16 lines
280 B
Go
// Copyright 2015 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.
|
|
|
|
package main
|
|
|
|
/*
|
|
//enum test { foo, bar };
|
|
*/
|
|
import "C"
|
|
|
|
func main() {
|
|
var a = C.enum_test(1) // ERROR HERE
|
|
_ = a
|
|
}
|