aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2022-10-15 15:00:18 -0700
committerDavid Tolnay <dtolnay@gmail.com>2022-10-15 15:00:44 -0700
commit6f257d81f43ba06d4637c61e3093275eef2e2e55 (patch)
tree40c78bdface997292bbbe0d6bd2fc28f2c51db48 /src
parent031723f9cbe00199c460e123318a1a493ac6ead0 (diff)
downloadcxx-6f257d81f43ba06d4637c61e3093275eef2e2e55.tar.gz
Allow trycatch to call Fail using std::string
Diffstat (limited to 'src')
-rw-r--r--src/cxx.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cxx.cc b/src/cxx.cc
index 4b0fd2e9..d3a87c0c 100644
--- a/src/cxx.cc
+++ b/src/cxx.cc
@@ -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