I have two source files that both #include <boost/asio.hpp>.
Both files use source_location. When I call the function (that uses source_location), it works as expected. When I call the one in the other (that also uses source_location) compilation unit , the program crashes. This happens only on MacOS (built for arm64 with GCC - I've tried with both 11.4, 13.1 and 14.1).
Using clang I do not see the issue.
However, using #include <source_location> instead of #include <boost/asio.hpp>, everything works fine.
I also noted, that if I just #include <boost/asio.hpp> in one file, but #include <source_location> in both files, everything works fine.
So the issue seem to arise when #include <boost/asio.hpp> in several different compilation units.
I have also attached the example. It should build out of the box (but might require you to change the boost include path in the CMakeLists.txt from /usr/local/boost_1_82_0 -> your own path).
Minimum working example to reproduce
I have two source files that both
#include <boost/asio.hpp>
. Both files usesource_location
. When I call the function (that usessource_location
), it works as expected. When I call the one in the other (that also usessource_location
) compilation unit , the program crashes. This happens only on MacOS (built for arm64 withGCC
- I've tried with both 11.4, 13.1 and 14.1).Using
clang
I do not see the issue.However, using
#include <source_location>
instead of#include <boost/asio.hpp>
, everything works fine.I also noted, that if I just
#include <boost/asio.hpp>
in one file, but#include <source_location>
in both files, everything works fine.So the issue seem to arise when
#include <boost/asio.hpp>
in several different compilation units.Stackoverflow details
For more details, see here.
Example zip
I have also attached the example. It should build out of the box (but might require you to change the boost include path in the
CMakeLists.txt
from /usr/local/boost_1_82_0 -> your own path).source_loc_test.zip