blob: a6abdd5c65727e5f5c03df72b5341df3aa099abe [file] [log] [blame]
Russ Cox57eb06f2012-02-16 23:51:04 -05001// compile
Russ Coxcf9f3802011-06-17 16:12:14 -04002
3// Copyright 2011 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
Rob Pike80a97832012-02-24 11:48:19 +11007// Test unsafe.Sizeof, unsafe.Alignof, and unsafe.Offsetof all return uintptr.
8
Russ Coxcf9f3802011-06-17 16:12:14 -04009package main
10
11import "unsafe"
12
13type T struct {
14 X int
15}
16
17var t T
18
19func isUintptr(uintptr) {}
20
21func main() {
22 isUintptr(unsafe.Sizeof(t))
23 isUintptr(unsafe.Alignof(t))
24 isUintptr(unsafe.Offsetof(t.X))
25}