gsl/narrow should include <exception> (#1044)

This file uses std::exception, so it should include the appropriate header.

Normally it gets the STL's <exception> header included via the gsl/assert file, but this is skipped with _HAS_EXCEPTIONS=0. I understand _HAS_EXCEPTIONS is undocumented and unsupported, but regardless, the appropriate header should be included here.

Alternatively, gsl/narrow should be modified to support _HAS_EXCEPTIONS=0, like gsl/assert was. But I'm not proposing that change. <exception> does define std::exception even with _HAS_EXCEPTIONS=0.
This commit is contained in:
Juan Carlos Arevalo Baeza 2022-04-26 14:41:10 -07:00 committed by GitHub
parent 2bfd495080
commit f21f29d210
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,7 @@
#define GSL_NARROW_H #define GSL_NARROW_H
#include "assert" // for Expects #include "assert" // for Expects
#include "util" // for narrow_cast #include "util" // for narrow_cast
#include <exception> // for std::exception
namespace gsl namespace gsl
{ {
struct narrowing_error : public std::exception struct narrowing_error : public std::exception