[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 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273697 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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_;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user