1 // RUN: %clang_cc1 -emit-llvm -triple i686-pc-win32 -std=c++11 -fms-extensions -verify -o - %s | FileCheck %s
2 // expected-no-diagnostics
4 // Class member templates
6 #pragma code_seg(push, "something")
9 struct __declspec(code_seg("foo_one")) ClassOne
{
10 int bar1(T t
) { return int(t
); }
16 int ClassOne
<T
>::bar2(T t
) {
22 return coi
.bar1(6) + coi
.bar2(3);
25 //CHECK: define {{.*}}bar1@?$ClassOne{{.*}} section "foo_one"
26 //CHECK: define {{.*}}bar2@?$ClassOne{{.*}} section "foo_one"
31 int bar11(T t
) { return int(t
); }
36 #pragma code_seg("newone")
39 int ClassTwo
<T
>::bar22(T t
) {
43 #pragma code_seg("someother")
46 int ClassTwo
<T
>::bar33(T t
) {
50 #pragma code_seg("yetanother")
54 return coi
.bar11(6) + coi
.bar22(3) + coi
.bar33(44);
57 //CHECK: define {{.*}}bar11@?$ClassTwo{{.*}} section "something"
58 //CHECK: define {{.*}}bar22@?$ClassTwo{{.*}} section "newone"
59 //CHECK: define {{.*}}bar33@?$ClassTwo{{.*}} section "someother"
62 struct ClassOne
<double>
64 int bar44(double d
) { return 1; }
67 struct __declspec(code_seg("foo_three")) ClassOne
<long>
69 int bar55(long d
) { return 1; }
72 #pragma code_seg("onemore")
76 return d
.bar44(1.0)+l
.bar55(1);
79 //CHECK: define {{.*}}bar44{{.*}} section "yetanother"
80 //CHECK: define {{.*}}bar55{{.*}} section "foo_three"
85 int __declspec(code_seg("foo_four")) bar66(T t
) { return int(t
); }
87 // specializations do not take the segment from primary
89 int bar66(int i
) { return 0; }
94 int bar66(char c
) { return 0; }
98 int __declspec(code_seg("foo_five")) bar66(A1 a
) { return a
.i
; }
102 // but instantiations do use the section from the primary
103 return bar66(0) + bar66(1.0) + bar66('c');
105 //CHECK: define {{.*}}bar66@H{{.*}} section "onemore"
106 //CHECK-NOT: define {{.*}}bar66@D{{.*}} section
107 //CHECK: define {{.*}}bar66@UA1{{.*}} section "foo_five"
108 //CHECK: define {{.*}}bar66@N{{.*}} section "foo_four"