diff options
author | David Tolnay <dtolnay@gmail.com> | 2022-10-15 15:00:18 -0700 |
---|---|---|
committer | David Tolnay <dtolnay@gmail.com> | 2022-10-15 15:00:44 -0700 |
commit | 6f257d81f43ba06d4637c61e3093275eef2e2e55 (patch) | |
tree | 40c78bdface997292bbbe0d6bd2fc28f2c51db48 /src | |
parent | 031723f9cbe00199c460e123318a1a493ac6ead0 (diff) | |
download | cxx-6f257d81f43ba06d4637c61e3093275eef2e2e55.tar.gz |
Allow trycatch to call Fail using std::string
Diffstat (limited to 'src')
-rw-r--r-- | src/cxx.cc | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -537,11 +537,16 @@ class Fail final { public: Fail(repr::PtrLen &throw$) : throw$(throw$) {} void operator()(const char *) noexcept; + void operator()(const std::string &) noexcept; }; void Fail::operator()(const char *catch$) noexcept { throw$ = cxxbridge1$exception(catch$, std::strlen(catch$)); } + +void Fail::operator()(const std::string &catch$) noexcept { + throw$ = cxxbridge1$exception(catch$.data(), catch$.length()); +} } // namespace detail } // namespace cxxbridge1 |