summaryrefslogtreecommitdiff
path: root/clang/test/Sema/overloaded-func-transparent-union.c
blob: fa0314e946f2a5252aba1a2fefe91a1592615c33 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// RUN: %clang_cc1 %s -fsyntax-only -verify
// rdar:// 9129552
// PR9406

typedef struct {
	char *str;
	char *str2;
} Class;

typedef union {
	Class *object;
} Instance __attribute__((transparent_union));

__attribute__((overloadable)) void Class_Init(Instance this, char *str, void *str2) {
	this.object->str  = str;
	this.object->str2 = str2;
}

__attribute__((overloadable)) void Class_Init(Instance this, char *str) {
	this.object->str  = str;
	this.object->str2 = str;
}

int main(void) {
	Class obj;
	Class_Init(&obj, "Hello ", " World");
}