summaryrefslogtreecommitdiff
path: root/include/experimental/optional
diff options
context:
space:
mode:
Diffstat (limited to 'include/experimental/optional')
-rw-r--r--include/experimental/optional8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/experimental/optional b/include/experimental/optional
index a384882a1e12..3912438ec104 100644
--- a/include/experimental/optional
+++ b/include/experimental/optional
@@ -517,7 +517,11 @@ public:
constexpr value_type const& value() const
{
if (!this->__engaged_)
+#ifndef _LIBCPP_NO_EXCEPTIONS
throw bad_optional_access();
+#else
+ assert(!"bad optional access");
+#endif
return this->__val_;
}
@@ -525,7 +529,11 @@ public:
value_type& value()
{
if (!this->__engaged_)
+#ifndef _LIBCPP_NO_EXCEPTIONS
throw bad_optional_access();
+#else
+ assert(!"bad optional access");
+#endif
return this->__val_;
}