1 // RUN: %clang_cc1 -triple x86_64-pc-linux  -fsyntax-only -verify -emit-llvm-only %s
2 
3 void f1(void) __attribute__((alias("g1")));
4 void g1(void) {
5 }
6 
7 void f2(void) __attribute__((alias("g2"))); // expected-error {{alias must point to a defined variable or function}}
8 
9 
10 void f3(void) __attribute__((alias("g3"))); // expected-error {{alias must point to a defined variable or function}}
11 void g3(void);
12 
13 
14 void f4() __attribute__((alias("g4")));
15 void g4() {}
16 void h4() __attribute__((alias("f4")));
17 
18 void f5() __attribute__((alias("g5")));
19 void h5() __attribute__((alias("f5")));
20 void g5() {}
21 
22 void g6() {}
23 void f6() __attribute__((alias("g6")));
24 void h6() __attribute__((alias("f6")));
25 
26 void g7() {}
27 void h7() __attribute__((alias("f7")));
28 void f7() __attribute__((alias("g7")));
29 
30 void h8() __attribute__((alias("f8")));
31 void g8() {}
32 void f8() __attribute__((alias("g8")));
33 
34 void h9() __attribute__((alias("f9")));
35 void f9() __attribute__((alias("g9")));
36 void g9() {}
37 
38 void f10() __attribute__((alias("g10"))); // expected-error {{alias definition is part of a cycle}}
39 void g10() __attribute__((alias("f10"))); // expected-error {{alias definition is part of a cycle}}
40 
41 // FIXME: This could be a bit better, h10 is not part of the cycle, it points
42 // to it.
43 void h10() __attribute__((alias("g10"))); // expected-error {{alias definition is part of a cycle}}
44 
45 extern int a1 __attribute__((alias("b1")));
46 int b1 = 42;
47 
48 extern int a2 __attribute__((alias("b2"))); // expected-error {{alias must point to a defined variable or function}}
49 
50 extern int a3 __attribute__((alias("b3"))); // expected-error {{alias must point to a defined variable or function}}
51 extern int b3;
52 
53 extern int a4 __attribute__((alias("b4"))); // expected-error {{alias must point to a defined variable or function}}
54 typedef int b4;
55