anonunion.go 516 B

1234567891011121314151617181920212223242526
  1. // Copyright 2014 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. // +build ignore
  6. package main
  7. // This file tests that when cgo -godefs sees a struct with a field
  8. // that is an anonymous union, the first field in the union is
  9. // promoted to become a field of the struct. See issue 6677 for
  10. // background.
  11. /*
  12. typedef struct {
  13. union {
  14. long l;
  15. int c;
  16. };
  17. } t;
  18. */
  19. import "C"
  20. // Input for cgo -godefs.
  21. type T C.t