Why would including <regex> cause sqrt( negative number ) to throw domain exceptions

Viewed 84

I have a program that regularly takes the std::sqrt() of negative numbers and checks for NaN as required.

Using gcc 6.3.0 (on an embedded platform), if I

#include <regex> 

in the same library, instead of returning NaN it will throw an exception.

The same code runs correctly when built using GCC 8.1 (in Windows) and Clang (in Mac)

I tried explicitly setting

#define math_errhandling MATH_ERRNO 

before calling all my other headers and it doesn't seem to have an effect.

0 Answers
Related