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    mydir = TestBase.compute_mydir(__file__)
18
19    @no_debug_info_test
20    def test(self):
21        self.build()
22        self.createTestTarget()
23
24        # Try using the class in the expression evaluator.
25        self.expect_expr(
26            "derived",
27            result_type="Derived",
28            result_children=[
29                ValueCheck(name="Base<Derived>"),
30                ValueCheck(name="member", value="0"),
31            ],
32        )
33
34        # Try accessing the members of the class and base class.
35        self.expect_expr("derived.pointer", result_type="Derived *")
36        self.expect_expr("derived.member", result_type="int", result_value="0")
37