1 // Copyright 2013 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Issue 7786. No runtime test, just make sure that typedef and struct/union/class are interchangeable at compile time. 6 7 package cgotest 8 9 // struct test7786; 10 // typedef struct test7786 typedef_test7786; 11 // void f7786(struct test7786 *ctx) {} 12 // void g7786(typedef_test7786 *ctx) {} 13 // 14 // typedef struct body7786 typedef_body7786; 15 // struct body7786 { int x; }; 16 // void b7786(struct body7786 *ctx) {} 17 // void c7786(typedef_body7786 *ctx) {} 18 // 19 // typedef union union7786 typedef_union7786; 20 // void u7786(union union7786 *ctx) {} 21 // void v7786(typedef_union7786 *ctx) {} 22 import "C" 23 24 func f() { 25 var x1 *C.typedef_test7786 26 var x2 *C.struct_test7786 27 x1 = x2 28 x2 = x1 29 C.f7786(x1) 30 C.f7786(x2) 31 C.g7786(x1) 32 C.g7786(x2) 33 34 var b1 *C.typedef_body7786 35 var b2 *C.struct_body7786 36 b1 = b2 37 b2 = b1 38 C.b7786(b1) 39 C.b7786(b2) 40 C.c7786(b1) 41 C.c7786(b2) 42 43 var u1 *C.typedef_union7786 44 var u2 *C.union_union7786 45 u1 = u2 46 u2 = u1 47 C.u7786(u1) 48 C.u7786(u2) 49 C.v7786(u1) 50 C.v7786(u2) 51 } 52