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