blob: a4c06eebf499b33dc70f6a5a90af7405357d37e5 [file] [log] [blame]
Rafael Espindolad53ffa02013-10-22 21:39:03 +00001// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -verify %s
2
3void f0() {}
4void fun0(void) __attribute((alias("f0")));
5
6void f1() {}
7void fun1() {} // expected-note {{previous definition}}
8void fun1(void) __attribute((alias("f1"))); // expected-error {{redefinition of 'fun1'}}
9
10void f2() {}
11void fun2(void) __attribute((alias("f2"))); // expected-note {{previous definition}}
12void fun2() {} // expected-error {{redefinition of 'fun2'}}
13
14void f3() {}
15void fun3(void) __attribute((alias("f3"))); // expected-note {{previous definition}}
16void fun3(void) __attribute((alias("f3"))); // expected-error {{redefinition of 'fun3'}}
17
18void f4() {}
19void fun4(void) __attribute((alias("f4")));
20void fun4(void);
21
Rafael Espindolad53ffa02013-10-22 21:39:03 +000022void f5() {}
Serge Pavlov947719b2017-02-18 06:04:15 +000023void __attribute((alias("f5"))) fun5(void) {} // expected-error {{definition 'fun5' cannot also be an alias}}
Rafael Espindolad53ffa02013-10-22 21:39:03 +000024
David Majnemer2dc81462015-01-19 09:00:28 +000025int var1 __attribute((alias("v1"))); // expected-error {{definition 'var1' cannot also be an alias}}
26static int var2 __attribute((alias("v2"))) = 2; // expected-error {{definition 'var2' cannot also be an alias}}
David Majnemer6b903562015-01-19 10:21:22 +000027
28extern int var3 __attribute__((alias("C"))); // expected-note{{previous definition is here}}
29int var3 = 3; // expected-error{{redefinition of 'var3'}}
David Majnemer1efd55f2015-01-21 00:52:17 +000030
David Majnemer290d3472015-01-21 01:30:40 +000031int var4; // expected-note{{previous definition is here}}
32extern int var4 __attribute__((alias("v4"))); // expected-error{{alias definition of 'var4' after tentative definition}}