Dan Willemsen | bc60c3c | 2021-12-15 01:09:00 -0800 | [diff] [blame] | 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 | // +build cgo | ||||
9 | |||||
10 | package main | ||||
11 | |||||
12 | // void f(int *p) { *p = 0x12345678; } | ||||
13 | import "C" | ||||
14 | |||||
15 | func main() { | ||||
16 | var x C.int | ||||
17 | func() { | ||||
18 | defer C.f(&x) | ||||
19 | }() | ||||
20 | if x != 0x12345678 { | ||||
21 | panic("FAIL") | ||||
22 | } | ||||
23 | } |