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