1*99451b44SJordan Rupprechtimport lldb
2*99451b44SJordan Rupprechtfrom lldbsuite.test.decorators import *
3*99451b44SJordan Rupprechtfrom lldbsuite.test.lldbtest import *
4*99451b44SJordan Rupprechtfrom lldbsuite.test import lldbutil
5*99451b44SJordan Rupprecht
6*99451b44SJordan Rupprechtclass TestCase(TestBase):
7*99451b44SJordan Rupprecht
8*99451b44SJordan Rupprecht    def test(self):
9*99451b44SJordan Rupprecht        self.build()
10*99451b44SJordan Rupprecht        lldbutil.run_to_source_breakpoint(self,"// break here", lldb.SBFileSpec("main.cpp"))
11*99451b44SJordan Rupprecht
12*99451b44SJordan Rupprecht        # Test calling a function that has const/non-const overload.
13*99451b44SJordan Rupprecht        self.expect_expr("c.func()", result_type="int", result_value="111")
14*99451b44SJordan Rupprecht        self.expect_expr("const_c.func()", result_type="int", result_value="222")
15*99451b44SJordan Rupprecht
16*99451b44SJordan Rupprecht        # Call a function that is only const on a const/non-const instance.
17*99451b44SJordan Rupprecht        self.expect_expr("c.const_func()", result_type="int", result_value="333")
18*99451b44SJordan Rupprecht        self.expect_expr("const_c.const_func()", result_type="int", result_value="333")
19*99451b44SJordan Rupprecht
20*99451b44SJordan Rupprecht        # Call a function that is not const on a const/non-const instance.
21*99451b44SJordan Rupprecht        self.expect_expr("c.nonconst_func()", result_type="int", result_value="444")
22*99451b44SJordan Rupprecht        self.expect("expr const_c.nonconst_func()", error=True,
23*99451b44SJordan Rupprecht            substrs=["'this' argument to member function 'nonconst_func' has type 'const C', but function is not marked const"])
24