xref: /llvm-project/lldb/test/API/lang/cpp/crtp/main.cpp (revision 4019699fa5fd153586f02fd7f6b7cfc51a688bf2)
1 template <typename T> struct Base {
BaseBase2   Base(T &t) : ref(t), pointer(&t) {}
3   // Try referencing `Derived` via different ways to potentially make LLDB
4   // pull in the definition (which would recurse back to this base class).
5   T &ref;
6   T *pointer;
funcBase7   T func() { return ref; }
8 };
9 
10 struct Derived : Base<Derived> {
DerivedDerived11   Derived() : Base<Derived>(*this) {}
12   int member = 0;
13 };
14 
15 Derived derived;
16 
main()17 int main() { return derived.member; }
18