[libcxx] r294249 - Merging r294133 and r294142:

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 6 13:59:20 PST 2017


Author: hans
Date: Mon Feb  6 15:59:19 2017
New Revision: 294249

URL: http://llvm.org/viewvc/llvm-project?rev=294249&view=rev
Log:
Merging r294133 and r294142:
------------------------------------------------------------------------
r294133 | marshall | 2017-02-05 12:06:38 -0800 (Sun, 05 Feb 2017) | 1 line

Change the base class of std::bad_optional_access.  This is a (subtle) ABI change, and is in response to http://http://wg21.link/LWG2806, which I *expect* to be adopted in Kona. I am making this change now in anticipation, and will get it into 4.0, because (a) 4.0 is the first release with std::optional, and (b) I don't want to make an ABI-change later, when the user base should be significantly larger. Note that I didn't change std::experimental::bad_optional_access, because that's still specified to derive from std::logic_error.
------------------------------------------------------------------------

------------------------------------------------------------------------
r294142 | marshall | 2017-02-05 12:52:32 -0800 (Sun, 05 Feb 2017) | 1 line

Restore the _NOEXCEPT on the dtor of bad_optional_access. Destructors are noexcept by default, so it's not really needed, but the other exception classes have the _NOEXCEPT, and gcc complains if these are missing. I think we should remove them all - but not today.
------------------------------------------------------------------------

Modified:
    libcxx/branches/release_40/   (props changed)
    libcxx/branches/release_40/include/optional
    libcxx/branches/release_40/src/optional.cpp
    libcxx/branches/release_40/test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp

Propchange: libcxx/branches/release_40/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Feb  6 15:59:19 2017
@@ -1,2 +1,2 @@
 /libcxx/branches/apple:136569-137939
-/libcxx/trunk:292013,292091,292607,292990,293154,293197,293581
+/libcxx/trunk:292013,292091,292607,292990,293154,293197,293581,294133,294142

Modified: libcxx/branches/release_40/include/optional
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/include/optional?rev=294249&r1=294248&r2=294249&view=diff
==============================================================================
--- libcxx/branches/release_40/include/optional (original)
+++ libcxx/branches/release_40/include/optional Mon Feb  6 15:59:19 2017
@@ -160,14 +160,12 @@ namespace std  // purposefully not using
 {
 
 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

Modified: libcxx/branches/release_40/src/optional.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/src/optional.cpp?rev=294249&r1=294248&r2=294249&view=diff
==============================================================================
--- libcxx/branches/release_40/src/optional.cpp (original)
+++ libcxx/branches/release_40/src/optional.cpp Mon Feb  6 15:59:19 2017
@@ -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

Modified: libcxx/branches/release_40/test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp?rev=294249&r1=294248&r2=294249&view=diff
==============================================================================
--- libcxx/branches/release_40/test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp (original)
+++ libcxx/branches/release_40/test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp Mon Feb  6 15:59:19 2017
@@ -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, "");
 }




More information about the cfe-commits mailing list