Skip to content

Commit f5772c9

Browse files
committed
Add negative case test for codegen failure in Cpp::Destruct
1 parent 0b358ce commit f5772c9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

unittests/CppInterOp/FunctionReflectionTest.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2406,6 +2406,20 @@ TEST(FunctionReflectionTest, Destruct) {
24062406
// Clean up resources
24072407
clang_Interpreter_takeInterpreterAsPtr(I);
24082408
clang_Interpreter_dispose(I);
2409+
2410+
// Failure test, this wrapper should not compile since we explicitly delete
2411+
// the destructor
2412+
Interp->declare(R"(
2413+
class D {
2414+
public:
2415+
D() {}
2416+
~D() = delete;
2417+
};
2418+
)");
2419+
2420+
scope = Cpp::GetNamed("D");
2421+
object = Cpp::Construct(scope);
2422+
EXPECT_FALSE(Cpp::Destruct(object, scope));
24092423
}
24102424

24112425
TEST(FunctionReflectionTest, DestructArray) {

0 commit comments

Comments
 (0)