mirror of
				https://github.com/golang/go.git
				synced 2025-10-31 00:30:57 +00:00 
			
		
		
		
	 5c2666c18c
			
		
	
	
		5c2666c18c
		
	
	
	
	
		
			
			Change unsafe.Pointer to be its own kind of type, instead of making it equivalent to *any. The change complicates import and export but avoids the need to find all the places that operate on pointers but should not operate on unsafe.Pointer. Fixes #1566. (a different way) Fixes #1582. R=ken2 CC=golang-dev https://golang.org/cl/4264050
		
			
				
	
	
		
			15 lines
		
	
	
	
		
			380 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
	
		
			380 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // errchk $G $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.
 | |
| 
 | |
| package main
 | |
| 
 | |
| import "unsafe"
 | |
| 
 | |
| func main() {
 | |
| 	var x unsafe.Pointer
 | |
| 	println(*x) // ERROR "invalid indirect.*unsafe.Pointer"
 | |
| 	var _ = (unsafe.Pointer)(nil).foo  // ERROR "no field or method foo"
 | |
| }
 |