Skip to content

Commit db8bbff

Browse files
committed
f
1 parent c53b7d1 commit db8bbff

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

include/CppInterOp/CppInterOp.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -172,16 +172,19 @@ class JitCall {
172172
// decide to directly.
173173
void Invoke(void* result, ArgList args = {}, void* self = nullptr) const {
174174
// NOLINTBEGIN(*-type-union-access)
175-
// Forward if we intended to call a dtor with only 1 parameter.
176-
if (m_Kind == kDestructorCall && result && !args.m_Args) {
177-
InvokeDestructor(result, /*nary=*/0UL, /*withFree=*/true);
178-
return;
179-
}
180-
// Forward if we intended to call a constructor (nary cannot be inferred, so
181-
// we stick to constructing a single object)
182-
else if (m_Kind == kConstructorCall && result && !args.m_Args) {
183-
InvokeConstructor(result, /*nary=*/1UL, args, self);
184-
return;
175+
// Its possible the JitCall object deals with structor decls but went through Invoke
176+
if (result && !args.m_Args && m_Kind!=kGenericCall) {
177+
// Forward if we intended to call a dtor with only 1 parameter.
178+
if (m_Kind == kDestructorCall) {
179+
InvokeDestructor(result, /*nary=*/0UL, /*withFree=*/true);
180+
return;
181+
}
182+
// Forward if we intended to call a constructor (nary cannot be inferred, so
183+
// we stick to constructing a single object)
184+
if (m_Kind == kConstructorCall) {
185+
InvokeConstructor(result, /*nary=*/1UL, args, self);
186+
return;
187+
}
185188
}
186189

187190
#ifndef NDEBUG

0 commit comments

Comments
 (0)