test/fixedbugs/issue47227.go
raw| 1 | // run fake-arg-to-force-use-of-go-run |
| 2 | |
| 3 | // Copyright 2021 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 | //go:build cgo |
| 8 | |
| 9 | package main |
| 10 | |
| 11 | // void f(int *p) { *p = 0x12345678; } |
| 12 | import "C" |
| 13 | |
| 14 | func main() { |
| 15 | var x C.int |
| 16 | func() { |
| 17 | defer C.f(&x) |
| 18 | }() |
| 19 | if x != 0x12345678 { |
| 20 | panic("FAIL") |
| 21 | } |
| 22 | } |