Clang Project

clang_source_code/test/Sema/overloaded-func-transparent-union.c
1// RUN: %clang_cc1 %s -fsyntax-only -verify
2// expected-no-diagnostics
3// rdar:// 9129552
4// PR9406
5
6typedef struct {
7 char *str;
8 char *str2;
9} Class;
10
11typedef union {
12 Class *object;
13} Instance __attribute__((transparent_union));
14
15__attribute__((overloadable)) void Class_Init(Instance this, char *str, void *str2) {
16 this.object->str  = str;
17 this.object->str2 = str2;
18}
19
20__attribute__((overloadable)) void Class_Init(Instance this, char *str) {
21 this.object->str  = str;
22 this.object->str2 = str;
23}
24
25int main(void) {
26 Class obj;
27 Class_Init(&obj, "Hello ", " World");
28}
29
30