brintos

brintos / llvm-project-archived public Read only

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