--- /dev/null
+"""
+Tests loading of classes when the loading is triggered via a typedef inside the
+class (and not via the normal LLDB lookup that first resolves the surrounding
+class).
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @no_debug_info_test
+ def test(self):
+ self.build()
+ self.createTestTarget()
+
+ # Print the top-level typedef which triggers the loading of the class
+ # that the typedef is defined inside.
+ self.expect_expr(
+ "pull_in_classes",
+ result_type="StructWithMember::MemberTypedef",
+ result_value="0",
+ )
+
+ # Print the classes and check their types.
+ self.expect_expr(
+ "struct_to_print",
+ result_type="StructWithMember",
+ result_children=[
+ ValueCheck(
+ name="m",
+ type="StructWithNested::Nested<int>::OtherTypedef",
+ children=[ValueCheck(name="i", value="0", type="int")],
+ )
+ ],
+ )
--- /dev/null
+struct TopLevelStruct {
+ int i;
+};
+
+// Contains a templated nested class with a typedef.
+struct StructWithNested {
+ template <typename T>
+ struct Nested {
+ // Typedef in a class. Intended to be referenced directly so that it can
+ // trigger the loading of the surrounding classes.
+ typedef TopLevelStruct OtherTypedef;
+ };
+};
+
+// Contains a typedef.
+struct StructWithMember {
+ // This member pulls in the typedef (and classes) above.
+ StructWithNested::Nested<int>::OtherTypedef m;
+ // Typedef in a class. Intended to be referenced directly so that it can
+ // trigger the loading of the surrounding class.
+ typedef int MemberTypedef;
+};
+
+// This is printed and will pull in the typedef in StructWithmember.
+StructWithMember::MemberTypedef pull_in_classes;
+
+
+StructWithMember struct_to_print;
+
+
+int main() {}