In this simple use of C++ contracts, I get the error: no type named 'fail_fast' in namespace 'gsl'
. Will try block throw the fast_fail
exception or some other exception?
#define GSL_THROW_ON_CONTRACT_VIOLATION
#include <gsl/gsl>
#include <iostream>
int main(void)
{
try {
Expects(false);
}
catch(const gsl::fail_fast &e) {
std::cout << "exception: " << e.what() << '\n';
}
}
GSL_THROW_ON_CONTRACT_VIOLATION
andgsl::fast_fail
were removed from the Microsoft GSL starting with release v3.0.0. All contract violations result in a call tostd::terminate
unless you are building in kernel mode for MSVC where it invokes__fastfail
.There was a period of time where
gsl::fast_fail
was defined only whenGSL_THROW_ON_CONTRACT_VIOLATION
was defined, however that was identified in #267 and subsequently fixed in #268.