xref: /llvm-project/lldb/test/API/lang/cpp/struct_with_keyword_name/TestStructWithKeywordName.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1import lldb
2from lldbsuite.test.decorators import *
3from lldbsuite.test.lldbtest import *
4from lldbsuite.test import lldbutil
5
6
7class TestCase(TestBase):
8    @no_debug_info_test
9    def test(self):
10        self.build()
11        lldbutil.run_to_source_breakpoint(
12            self, "// break here", lldb.SBFileSpec("main.c")
13        )
14
15        # First run this in C which should work.
16        self.expect_expr("constexpr.class", result_type="int", result_value="3")
17
18        # Now try running this in a language that explicitly enables C++.
19        # This isn't expected to work, but at least it shouldn't crash LLDB.
20        self.expect(
21            "expr -l c++ -- constexpr.class",
22            error=True,
23            substrs=["expected unqualified-id"],
24        )
25        self.expect(
26            "expr -l objective-c++ -- constexpr.class",
27            error=True,
28            substrs=["expected unqualified-id"],
29        )
30