blob: 3b1df3b8feb9385e539c2e0200849b2c74de564e [file] [log] [blame]
Russ Cox80803842012-02-16 23:49:59 -05001// run
Russ Cox80ac15e2010-05-24 14:18:15 -07002
Emmanuel Odeke53fd5222016-04-10 14:32:26 -07003// Copyright 2010 The Go Authors. All rights reserved.
Russ Cox80ac15e2010-05-24 14:18:15 -07004// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
Brad Fitzpatrick2ae77372015-07-10 17:17:11 -06007// https://golang.org/issue/799
Russ Cox80ac15e2010-05-24 14:18:15 -07008
9package main
10
11import "unsafe"
12
13func main() {
14 n := unsafe.Sizeof(0)
15 if n != 4 && n != 8 {
16 println("BUG sizeof 0", n)
17 return
18 }
19 n = unsafe.Alignof(0)
20 if n != 4 && n != 8 {
21 println("BUG alignof 0", n)
22 return
23 }
24
25 n = unsafe.Sizeof("")
26 if n != 8 && n != 16 {
27 println("BUG sizeof \"\"", n)
28 return
29 }
30 n = unsafe.Alignof("")
31 if n != 4 && n != 8 {
32 println("BUG alignof \"\"", n)
33 return
34 }
35}
36