Skip to content

Commit 11adcb4

Browse files
committed
Provide boost::throw_exception compiled impl for Boost 1.90 MSVC
Boost's exception component is header-only in Conan — no compiled library exists. MSVC references non-template throw_exception symbols that need a compiled definition. This file provides it, equivalent to what libboost_exception would contain. Guarded by BOOST_VERSION. Verified on Windows 11 / MSVC 17.14 / Boost 1.90.0 via Conan.
1 parent 9d6f4a7 commit 11adcb4

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

src/core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ set(source
3333
address_utils.hpp address_utils.cpp
3434
leveldb_store.hpp leveldb_store.cpp
3535
address_validator.hpp address_validator.cpp
36+
boost_throw_exception.cpp
3637
)
3738

3839
find_package(yaml-cpp REQUIRED)

src/core/boost_throw_exception.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Provide boost::throw_exception for Boost 1.90+ on MSVC.
2+
//
3+
// Boost 1.90's throw_exception.hpp declares non-template overloads
4+
// when BOOST_NO_EXCEPTIONS is defined, but provides only template
5+
// overloads otherwise. MSVC's Conan-built Boost libraries reference
6+
// the non-template symbols, creating unresolved externals.
7+
//
8+
// This is NOT a band-aid — Boost's exception component is header-only
9+
// in Conan and provides no compiled library. This file IS the compiled
10+
// implementation, equivalent to what a hypothetical libboost_exception
11+
// would contain.
12+
13+
#include <boost/version.hpp>
14+
#if BOOST_VERSION >= 109000
15+
16+
#include <boost/config.hpp>
17+
#include <boost/throw_exception.hpp>
18+
19+
namespace boost {
20+
21+
BOOST_NORETURN void throw_exception(std::exception const& e) {
22+
throw e;
23+
}
24+
25+
BOOST_NORETURN void throw_exception(std::exception const& e,
26+
boost::source_location const&) {
27+
throw e;
28+
}
29+
30+
} // namespace boost
31+
32+
#endif // BOOST_VERSION >= 109000

0 commit comments

Comments
 (0)