blob: c9bd6a3f03bb27871794b794f746a196bdb2f6d1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
struct ContextClass {
int member = 3;
ContextClass *this_type = nullptr;
ContextClass() { this_type = this; }
int func() const {
return member; // break in function in class.
}
template <class T> T templateFunc(T x) const {
return member; // break in templated function in class.
}
};
template <typename TC> struct TemplatedContextClass {
int member = 4;
TemplatedContextClass<TC> *this_type = nullptr;
TemplatedContextClass() { this_type = this; }
int func() const {
return member; // break in function in templated class.
}
template <class T> T templateFunc(T x) const {
return member; // break in templated function in templated class.
}
};
int main() {
ContextClass c;
TemplatedContextClass<int> t;
return c.func() + c.templateFunc(1) + t.func() + t.templateFunc(1);
}
|