[libcxx] r273697 - [libcxx] guard throw with exception enabling check
Weiming Zhao via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 24 11:02:27 PDT 2016
Author: weimingz
Date: Fri Jun 24 13:02:27 2016
New Revision: 273697
URL: http://llvm.org/viewvc/llvm-project?rev=273697&view=rev
Log:
[libcxx] guard throw with exception enabling check
Summary: this fixes build error when built with c++14 and no exceptions
Reviewers: rmaprath
Subscribers: weimingz, grandinj, rmaprath, cfe-commits
Differential Revision: http://reviews.llvm.org/D21673
Modified:
libcxx/trunk/include/experimental/optional
Modified: libcxx/trunk/include/experimental/optional
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/optional?rev=273697&r1=273696&r2=273697&view=diff
==============================================================================
--- libcxx/trunk/include/experimental/optional (original)
+++ libcxx/trunk/include/experimental/optional Fri Jun 24 13:02:27 2016
@@ -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_;
}
More information about the cfe-commits
mailing list