First, implementing ignore_abort in namespace std is forbidden by N4842 16.5.4.2.1 [namespace.std]/1: "Unless otherwise specified, the behavior of a C++ program is undefined if it adds declarations or definitions to namespace std or to a namespace within namespace std."
Second, macroizing abort is extremely forbidden by 16.5.4.3.2 [macro.names]/1: "A translation unit that includes a standard library header shall not #define or #undef names declared in any standard library header."
This code is non-conformant and fails to compile with the current development version of Visual Studio:
https://github.com/boostorg/stacktrace/blob/211d29125310fa14c38d8a38cb7ef1cbca863928/example/assert_handler.cpp#L27-L34
First, implementing
ignore_abort
innamespace std
is forbidden by N4842 16.5.4.2.1 [namespace.std]/1: "Unless otherwise specified, the behavior of a C++ program is undefined if it adds declarations or definitions to namespacestd
or to a namespace within namespacestd
."Second, macroizing
abort
is extremely forbidden by 16.5.4.3.2 [macro.names]/1: "A translation unit that includes a standard library header shall not#define
or#undef
names declared in any standard library header."Third, this is failing to compile for the current development version of MSVC's STL because including
<iostream>
drags in<istream>
,<ostream>
,<ios>
, internal<xlocnum>
, and finally<cmath>
where our implementation oflerp()
contains a call to::abort()
which is broken by the macroizedabort
: https://github.com/microsoft/STL/blob/94c9f9965b4e39bab9fdec6f71f1fad320e96d8b/stl/inc/cmath#L1379-L1380The
assert_handler.cpp
example should be changed to follow the Standard's requirements.