1"""
2A test for the curiously recurring template pattern (or CRTP).
3
4Note that the derived class is referenced directly from the parent class in the
5test. If this fails then there is a good chance that LLDB tried to eagerly
6resolve the definition of the derived class while constructing the base class.
7"""
8
9import lldb
10from lldbsuite.test.decorators import *
11from lldbsuite.test.lldbtest import *
12from lldbsuite.test import lldbutil
13
14
15class TestCase(TestBase):
16
17    @no_debug_info_test
18    def test(self):
19        self.build()
20        self.createTestTarget()
21
22        # Try using the class in the expression evaluator.
23        self.expect_expr(
24            "derived",
25            result_type="Derived",
26            result_children=[
27                ValueCheck(name="Base<Derived>"),
28                ValueCheck(name="member", value="0"),
29            ],
30        )
31
32        # Try accessing the members of the class and base class.
33        self.expect_expr("derived.pointer", result_type="Derived *")
34        self.expect_expr("derived.member", result_type="int", result_value="0")
35