Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp =================================================================== --- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -2499,6 +2499,7 @@ case clang::Type::Decltype: case clang::Type::Elaborated: case clang::Type::Paren: + case clang::Type::SubstTemplateTypeParm: case clang::Type::TemplateSpecialization: case clang::Type::Typedef: case clang::Type::TypeOf: Index: lldb/test/API/lang/cpp/subst_template_type_param/TestSubstTemplateTypeParam.py =================================================================== --- /dev/null +++ lldb/test/API/lang/cpp/subst_template_type_param/TestSubstTemplateTypeParam.py @@ -0,0 +1,34 @@ +""" +Test that SubstTemplateTypeParam types (which are produces as type sugar +when template type parameter are used for example as field types). +""" + +import lldb +import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test.lldbtest import * +from lldbsuite.test import decorators + +class TestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + def test_typedef(self): + target = self.dbg.GetDummyTarget() + + # Declare a template class with a field that uses the template type + # parameter. + opts = lldb.SBExpressionOptions() + opts.SetTopLevel(True) + result = target.EvaluateExpression("template struct X { T f; };", opts) + # FIXME: This fails with "Couldn't find $__lldb_expr() in the module" + # but it should succeed. The fact that this code has nothing to run + # shouldn't be an error. + # self.assertSuccess(result.GetError()) + + # Instantiate and produce a value with that template as the type. + # The field in the value will have a SubstTemplateTypeParam that + # should behave like a normal field. + result = target.EvaluateExpression("X x; x.f = 123; x") + self.assertEqual(result.GetNumChildren(), 1) + self.assertEqual(result.GetChildAtIndex(0).GetTypeName(), "int") + self.assertEqual(result.GetChildAtIndex(0).GetValue(), "123")