aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-02-11 13:25:42 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-02-11 13:25:42 +0000
commite392b74caad5d93946653d4656f1b354fa0ef713 (patch)
tree0432181d8ae0e410bfb961f7d0a14a6b60b68b6c
parent7c24d4db412189cf83de2bb328543564c8ad9224 (diff)
downloadsrc-e392b74caad5d93946653d4656f1b354fa0ef713.tar.gz
src-e392b74caad5d93946653d4656f1b354fa0ef713.zip
Vendor import of libc++ release_40 branch r294803:vendor/libc++/libc++-release_40-r294803
Notes
Notes: svn path=/vendor/libc++/dist/; revision=313638 svn path=/vendor/libc++/libc++-release_40-r294803/; revision=313639; tag=vendor/libc++/libc++-release_40-r294803
-rw-r--r--docs/conf.py4
-rw-r--r--include/optional6
-rw-r--r--include/variant2
-rw-r--r--src/optional.cpp4
-rw-r--r--test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp6
-rw-r--r--test/std/utilities/variant/variant.visit/visit.pass.cpp11
6 files changed, 23 insertions, 10 deletions
diff --git a/docs/conf.py b/docs/conf.py
index dee0367a4ed0..743d0f7edad0 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -47,9 +47,9 @@ copyright = u'2011-2017, LLVM Project'
# built documents.
#
# The short X.Y version.
-version = '4.0'
+version = '4'
# The full version, including alpha/beta/rc tags.
-release = '4.0'
+release = '4'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/include/optional b/include/optional
index c002cc729059..8f47986242ca 100644
--- a/include/optional
+++ b/include/optional
@@ -160,14 +160,12 @@ namespace std // purposefully not using versioning namespace
{
class _LIBCPP_EXCEPTION_ABI bad_optional_access
- : public logic_error
+ : public exception
{
public:
- _LIBCPP_INLINE_VISIBILITY
- bad_optional_access() : logic_error("bad optional access") {}
-
// Get the key function ~bad_optional_access() into the dylib
virtual ~bad_optional_access() _NOEXCEPT;
+ virtual const char* what() const _NOEXCEPT;
};
} // std
diff --git a/include/variant b/include/variant
index f623cddc2002..bbd4bf4895ad 100644
--- a/include/variant
+++ b/include/variant
@@ -574,7 +574,7 @@ private:
constexpr decltype(auto) operator()(_Alts&&... __alts) const {
__std_visit_exhaustive_visitor_check<
_Visitor,
- decltype(_VSTD::forward<_Alts>(__alts).__value)...>();
+ decltype((_VSTD::forward<_Alts>(__alts).__value))...>();
return __invoke_constexpr(_VSTD::forward<_Visitor>(__visitor),
_VSTD::forward<_Alts>(__alts).__value...);
}
diff --git a/src/optional.cpp b/src/optional.cpp
index f2fbfdfec1ce..2877d175bc1b 100644
--- a/src/optional.cpp
+++ b/src/optional.cpp
@@ -15,6 +15,10 @@ namespace std
bad_optional_access::~bad_optional_access() _NOEXCEPT = default;
+const char* bad_optional_access::what() const _NOEXCEPT {
+ return "bad_optional_access";
+ }
+
} // std
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
diff --git a/test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp b/test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp
index 85e36d2c107d..d96f70bb7ba4 100644
--- a/test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp
+++ b/test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp
@@ -11,7 +11,7 @@
// <optional>
-// class bad_optional_access : public logic_error
+// class bad_optional_access : public exception
#include <optional>
#include <type_traits>
@@ -20,6 +20,6 @@ int main()
{
using std::bad_optional_access;
- static_assert(std::is_base_of<std::logic_error, bad_optional_access>::value, "");
- static_assert(std::is_convertible<bad_optional_access*, std::logic_error*>::value, "");
+ static_assert(std::is_base_of<std::exception, bad_optional_access>::value, "");
+ static_assert(std::is_convertible<bad_optional_access*, std::exception*>::value, "");
}
diff --git a/test/std/utilities/variant/variant.visit/visit.pass.cpp b/test/std/utilities/variant/variant.visit/visit.pass.cpp
index 46d225883ae9..408a65c0903f 100644
--- a/test/std/utilities/variant/variant.visit/visit.pass.cpp
+++ b/test/std/utilities/variant/variant.visit/visit.pass.cpp
@@ -283,9 +283,20 @@ void test_exceptions() {
#endif
}
+// See http://llvm.org/PR31916
+void test_caller_accepts_nonconst() {
+ struct A {};
+ struct Visitor {
+ void operator()(A&) {}
+ };
+ std::variant<A> v;
+ std::visit(Visitor{}, v);
+}
+
int main() {
test_call_operator_forwarding();
test_argument_forwarding();
test_constexpr();
test_exceptions();
+ test_caller_accepts_nonconst();
}