From 4159cf0d22673c76a800dc9fb0e1453f5e28db90 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 20 Jan 2015 11:51:03 +0000 Subject: [PATCH] re PR libstdc++/64650 (std::experimental::bad_optional_access is not default constructible) PR libstdc++/64650 * include/experimental/optional (bad_optional_access): Add default constructor. * testsuite/experimental/optional/requirements.cc: Test for default constructor. From-SVN: r219889 --- libstdc++-v3/ChangeLog | 8 ++++++++ libstdc++-v3/include/experimental/optional | 4 ++-- .../testsuite/experimental/optional/requirements.cc | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 3274825b593..0777516053b 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2015-01-20 Jonathan Wakely + + PR libstdc++/64650 + * include/experimental/optional (bad_optional_access): Add default + constructor. + * testsuite/experimental/optional/requirements.cc: Test for default + constructor. + 2015-01-20 Jonathan Wakely * include/bits/stl_map.h (map::find<>, map::count<>, diff --git a/libstdc++-v3/include/experimental/optional b/libstdc++-v3/include/experimental/optional index 206b945998a..811235bfce4 100644 --- a/libstdc++-v3/include/experimental/optional +++ b/libstdc++-v3/include/experimental/optional @@ -110,9 +110,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class bad_optional_access : public logic_error { public: - // XXX Should not be inline - explicit bad_optional_access(const string& __arg) : logic_error(__arg) { } + bad_optional_access() : logic_error("bad optional access") { } + // XXX This constructor is non-standard. Should not be inline explicit bad_optional_access(const char* __arg) : logic_error(__arg) { } virtual ~bad_optional_access() noexcept = default; diff --git a/libstdc++-v3/testsuite/experimental/optional/requirements.cc b/libstdc++-v3/testsuite/experimental/optional/requirements.cc index e83975adae2..531b6ca4101 100644 --- a/libstdc++-v3/testsuite/experimental/optional/requirements.cc +++ b/libstdc++-v3/testsuite/experimental/optional/requirements.cc @@ -23,6 +23,9 @@ #include +using std::experimental::bad_optional_access; +static_assert( std::is_default_constructible::value, "" ); + struct trivially_destructible { trivially_destructible() = delete; -- 2.30.2