Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions include/cppoptlib/function_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ struct FunctionCRTP : public FunctionInterface<TScalar, TMode, TDimension> {
return static_cast<const Derived*>(this)->operator()(x);
} else if constexpr (TMode == DifferentiabilityMode::First) {
if (hess) {
throw std::runtime_error(
"Hessian not available for first order function.");
#if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)
throw std::runtime_error(
"Hessian not available for first order function.");
#else
std::abort();
#endif
}
return static_cast<const Derived*>(this)->operator()(x, grad);
} else { // DifferentiabilityMode::Second
Expand Down
Loading