From patchwork Mon Jan 19 15:35:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 430567 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C3A08140151 for ; Tue, 20 Jan 2015 02:35:27 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=Te7S9pdU0hZ9Jz7+/TkGQ7ySu3yoCHZURhAMYbDo8QDlpwZc3Ue8L 3xG+Cm921TUUA7b+Ar50VX4j1jtiBEc3ZteJRaDSDqp3562tV7QWmyMEwzVdZ5rD uO6qeYjeDS/rwAlTmNSIGJ0HB56PtvqNd/7M/JGZowTPVmtVjShM0c= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=7fCKi9Shonja1sVOh9ke3R3GN68=; b=n/Vvs5akWCPzFfdrOhbl GWQwIOGBaaC19uwNcLEbN3BxTnQFD3nWvBBrO/Attpep6e1xY4JjXjB/oHHWqGks tiVPv0Ss3lxcSb7H9Xka8yuy1VmCDGzAuD+52MSL70B2qScfp5d53toUJZOxT3rR Gz0GOHbC3/2g6Zu5Y3pwaVY= Received: (qmail 18605 invoked by alias); 19 Jan 2015 15:35:09 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 18583 invoked by uid 89); 19 Jan 2015 15:35:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 19 Jan 2015 15:35:06 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0JFZ3rC019656 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 19 Jan 2015 10:35:04 -0500 Received: from localhost (ovpn-116-18.ams2.redhat.com [10.36.116.18]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t0JFZ2YW029140; Mon, 19 Jan 2015 10:35:03 -0500 Date: Mon, 19 Jan 2015 15:35:02 +0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [patch] libstdc++/64650 add bad_optional_access default constructor Message-ID: <20150119153502.GI3360@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) The Library Fundamentals TS says std::experimental::bad_optional_access should have a default constructor, but we only support construction from strings. This removes the unused and non-standard std::string constructor and adds the required default constructor. Tested x86_64-linux, *not* committed. commit a3012f752e52870c9d257187a3c43e9fc2873892 Author: Jonathan Wakely Date: Sun Jan 18 16:52:07 2015 +0000 PR libstdc++/64650 * include/experimental/optional (bad_optional_access): Add default constructor. * testsuite/experimental/optional/requirements.cc: Test for default constructor. diff --git a/libstdc++-v3/include/experimental/optional b/libstdc++-v3/include/experimental/optional index 206b945..811235b 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 e83975a..531b6ca 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;