2012-02-16 21:49:59 -07:00
|
|
|
// run
|
2010-07-15 17:13:47 -06:00
|
|
|
|
2016-04-10 15:32:26 -06:00
|
|
|
// Copyright 2010 The Go Authors. All rights reserved.
|
2010-07-15 17:13:47 -06:00
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2015-07-10 17:17:11 -06:00
|
|
|
// https://golang.org/issue/843
|
2010-07-15 17:13:47 -06:00
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import "unsafe"
|
|
|
|
|
|
|
|
type T struct {
|
|
|
|
X, Y uint8
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
var t T
|
|
|
|
if unsafe.Offsetof(t.X) != 0 || unsafe.Offsetof(t.Y) != 1 {
|
|
|
|
println("BUG", unsafe.Offsetof(t.X), unsafe.Offsetof(t.Y))
|
|
|
|
}
|
|
|
|
}
|