199451b44SJordan Rupprechtimport lldb 299451b44SJordan Rupprechtfrom lldbsuite.test.decorators import * 399451b44SJordan Rupprechtfrom lldbsuite.test.lldbtest import * 499451b44SJordan Rupprechtfrom lldbsuite.test import lldbutil 599451b44SJordan Rupprecht 699451b44SJordan Rupprechtclass TestCase(TestBase): 799451b44SJordan Rupprecht 8*487ac0b3SRaphael Isemann @expectedFailureAll(bugnumber="llvm.org/pr50814", compiler="gcc") 999451b44SJordan Rupprecht def test_constructors(self): 1099451b44SJordan Rupprecht self.build() 1199451b44SJordan Rupprecht lldbutil.run_to_source_breakpoint(self,"// break here", lldb.SBFileSpec("main.cpp")) 1299451b44SJordan Rupprecht self.expect_expr("ClassWithImplicitCtor().foo()", result_type="int", result_value="1") 13b4608efcSRaphael Isemann self.expect_expr("ClassWithOneCtor(2).value", result_type="int", result_value="2") 1499451b44SJordan Rupprecht self.expect_expr("ClassWithMultipleCtor(3).value", result_type="int", result_value="3") 1599451b44SJordan Rupprecht self.expect_expr("ClassWithMultipleCtor(3, 1).value", result_type="int", result_value="4") 1699451b44SJordan Rupprecht 1799451b44SJordan Rupprecht self.expect_expr("ClassWithDeletedCtor().value", result_type="int", result_value="6") 1899451b44SJordan Rupprecht self.expect_expr("ClassWithDeletedDefaultCtor(7).value", result_type="int", result_value="7") 1999451b44SJordan Rupprecht 2099451b44SJordan Rupprecht # FIXME: It seems we try to call the non-existent default constructor here which is wrong. 21010d7a38SDave Lee self.expect("expr ClassWithDefaultedCtor().foo()", error=True, substrs=["Couldn't lookup symbols:"]) 2299451b44SJordan Rupprecht 2399451b44SJordan Rupprecht # FIXME: Calling deleted constructors should fail before linking. 2499451b44SJordan Rupprecht self.expect("expr ClassWithDeletedCtor(1).value", error=True, substrs=["Couldn't lookup symbols:"]) 2599451b44SJordan Rupprecht self.expect("expr ClassWithDeletedDefaultCtor().value", error=True, substrs=["Couldn't lookup symbols:"]) 2699451b44SJordan Rupprecht 274a9011dcSRaphael Isemann @skipIfWindows # Can't find operator new. 282bab1738SRaphael Isemann @skipIfLinux # Fails on some Linux systems with SIGABRT. 292bab1738SRaphael Isemann def test_constructors_new(self): 302bab1738SRaphael Isemann self.build() 312bab1738SRaphael Isemann lldbutil.run_to_source_breakpoint(self,"// break here", lldb.SBFileSpec("main.cpp")) 322bab1738SRaphael Isemann 33a3093bfbSRaphael Isemann self.expect_expr("(new ClassWithOneCtor(1))->value; 1", result_type="int", result_value="1") 34