gc: improve unsafe.Pointer type-check error messages

Fixes #2627.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5498088
This commit is contained in:
Ryan Hitchman 2012-01-06 14:34:16 -08:00 committed by Ian Lance Taylor
parent 518872bf8f
commit a15448d65e
2 changed files with 17 additions and 0 deletions

View File

@ -79,6 +79,7 @@ static char* _typekind[] = {
[TSTRING] = "string",
[TPTR32] = "pointer",
[TPTR64] = "pointer",
[TUNSAFEPTR] = "unsafe.Pointer",
[TSTRUCT] = "struct",
[TINTER] = "interface",
[TCHAN] = "chan",

16
test/fixedbugs/bug390.go Normal file
View File

@ -0,0 +1,16 @@
// errchk $G -e $D/$F.go
// Copyright 2011 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.
// Issue 2627 -- unsafe.Pointer type isn't handled nicely in some errors
package main
import "unsafe"
func main() {
var x *int
_ = unsafe.Pointer(x) - unsafe.Pointer(x) // ERROR "operator - not defined on unsafe.Pointer"
}