Skip to content

Commit 881fd11

Browse files
duncanwernerPatWie
authored andcommitted
add flags for GCC, CLang, MSVC
1 parent 7a154e0 commit 881fd11

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

include/cppoptlib/function_base.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,12 @@ struct FunctionCRTP : public FunctionInterface<TScalar, TMode, TDimension> {
106106
return static_cast<const Derived*>(this)->operator()(x);
107107
} else if constexpr (TMode == DifferentiabilityMode::First) {
108108
if (hess) {
109+
#if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)
109110
throw std::runtime_error(
110111
"Hessian not available for first order function.");
112+
#else
113+
std::abort();
114+
#endif
111115
}
112116
return static_cast<const Derived*>(this)->operator()(x, grad);
113117
} else { // DifferentiabilityMode::Second

0 commit comments

Comments
 (0)