1// run 2 3// Copyright 2019 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 7// Check closure in const declaration group can be compiled 8// and set correct value 9 10package main 11 12import "unsafe" 13 14const ( 15 x = unsafe.Sizeof(func() {}) 16 y 17) 18 19func main() { 20 const ( 21 z = unsafe.Sizeof(func() {}) 22 t 23 ) 24 25 // x and y must be equal 26 println(x == y) 27 // size must be greater than zero 28 println(y > 0) 29 30 // Same logic as x, y above 31 println(z == t) 32 println(t > 0) 33} 34