transparent-union.c 324 B

1234567891011121314151617181920212223242526
  1. struct a {
  2. int field;
  3. };
  4. struct b {
  5. int field;
  6. };
  7. typedef union {
  8. struct a *a;
  9. struct b *b;
  10. } transparent_arg __attribute__((__transparent_union__));
  11. static void foo(transparent_arg arg)
  12. {
  13. }
  14. static void bar(void)
  15. {
  16. struct b arg = { 0 };
  17. foo((struct a *) &arg);
  18. }
  19. /*
  20. * check-name: Transparent union attribute.
  21. */