1 // RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s -triple x86_64-pc-win32
2 // expected-no-diagnostics
4 // Non-Member Function Overloading is involved
6 int __declspec(code_seg("foo_one")) bar_one(int) { return 1; }
7 //CHECK: define {{.*}}bar_one{{.*}} section "foo_one"
8 int __declspec(code_seg("foo_two")) bar_one(int,float) { return 11; }
9 //CHECK: define {{.*}}bar_one{{.*}} section "foo_two"
10 int __declspec(code_seg("foo_three")) bar_one(float) { return 12; }
11 //CHECK: define {{.*}}bar_one{{.*}} section "foo_three"
13 // virtual function overloading is involved
15 struct __declspec(code_seg("my_one")) Base3
{
16 virtual int barA(int) { return 1; }
17 virtual int barA(int,float) { return 2; }
18 virtual int barA(float) { return 3; }
20 virtual void __declspec(code_seg("my_two")) barB(int) { }
21 virtual void __declspec(code_seg("my_three")) barB(float) { }
22 virtual void __declspec(code_seg("my_four")) barB(int, float) { }
26 //CHECK: define {{.*}}barA@Base3{{.*}} section "my_one"
27 //CHECK: define {{.*}}barA@Base3{{.*}} section "my_one"
28 //CHECK: define {{.*}}barA@Base3{{.*}} section "my_one"
29 //CHECK: define {{.*}}barB@Base3{{.*}} section "my_two"
30 //CHECK: define {{.*}}barB@Base3{{.*}} section "my_three"
31 //CHECK: define {{.*}}barB@Base3{{.*}} section "my_four"
33 #pragma code_seg("another")
35 struct __declspec(code_seg("foo_four")) Foo
{
36 int bar3() {return 0;}
37 __declspec(code_seg("foo_lala")) int bar4() {return 0;} }; int caller() {Foo f
; return f
.bar3() + f
.bar4(); }
39 //CHECK: define {{.*}}bar3@Foo{{.*}} section "foo_four"
40 //CHECK: define {{.*}}bar4@Foo{{.*}} section "foo_lala"
43 #pragma code_seg("something")
45 int __declspec(code_seg("foo")) bar1()
48 auto l
= [=](int i
) { return i
+4; };
52 //CHECK: define {{.*}}bar1{{.*}} section "foo"
53 //CHECK: define {{.*}}lambda{{.*}}bar1{{.*}} section "something"
55 double __declspec(code_seg("foo")) bar2()
58 auto l
= [=](double d
) __declspec(code_seg("another")) { return d
+4.0; };
62 //CHECK: define {{.*}}bar2{{.*}} section "foo"
63 //CHECK: define {{.*}}lambda{{.*}}bar2{{.*}} section "another"