diff --git a/src/api/api_arith.cc b/src/api/api_arith.cc index cba70370f5b6..a714fe37005b 100644 --- a/src/api/api_arith.cc +++ b/src/api/api_arith.cc @@ -109,7 +109,10 @@ TVM_REGISTER_API("arith._CreateAnalyzer") }); } else if (name == "enter_constraint_context") { return PackedFunc([self](TVMArgs args, TVMRetValue *ret) { - auto ctx = std::make_shared(self.get(), args[0]); + // can't use make_shared due to noexcept(false) decl in destructor, + // see https://stackoverflow.com/a/43907314 + auto ctx = + std::shared_ptr(new ConstraintContext(self.get(), args[0])); auto fexit = [ctx](TVMArgs, TVMRetValue*) mutable { ctx.reset(); };