mirror of
https://github.com/golang/go
synced 2024-11-24 23:17:57 -07:00
b565d1ec16
Cgo's initial design for handling "#define foo int*" involved rewriting "C.foo" to "*_Ctype_int" everywhere. But now that we have type aliases, we can declare "type _Ctype_foo = *_Ctype_int" once, and then rewrite "C.foo" to just "_Ctype_foo". This is important for go/types's UsesCgo mode, where go/types needs to be able to figure out a type for each C.foo identifier using only the information written into _cgo_gotypes.go. Fixes #38649. Change-Id: Ia0f8c2d82df81efb1be5bc26195ea9154c0af871 Reviewed-on: https://go-review.googlesource.com/c/go/+/230037 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
27 lines
591 B
Go
27 lines
591 B
Go
// Copyright 2014 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package main
|
|
|
|
// Test that the struct field in anonunion.go was promoted.
|
|
var v1 T
|
|
var v2 = v1.L
|
|
|
|
// Test that P, Q, and R all point to byte.
|
|
var v3 = Issue8478{P: (*byte)(nil), Q: (**byte)(nil), R: (***byte)(nil)}
|
|
|
|
// Test that N, A and B are fully defined
|
|
var v4 = N{}
|
|
var v5 = A{}
|
|
var v6 = B{}
|
|
|
|
// Test that S is fully defined
|
|
var v7 = S{}
|
|
|
|
// Test that #define'd type is fully defined
|
|
var _ = issue38649{X: 0}
|
|
|
|
func main() {
|
|
}
|