From patchwork Mon Jun 23 22:12:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 363210 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 D8761140081 for ; Tue, 24 Jun 2014 08:13:05 +1000 (EST) 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=SFXdxc6NOLSidopZzVdGEy2q9C8Br3jU8F6Y1NPehmkumYtJGqMgt F6fXbf5f3XYkIBvG0Tl/c03oKhdBFsdBTN+Gb1dyr4O/SviP5GAdL7Ubnwc0hk6a Km44kRVJvzZzw9cuMc1ueWnXcIsLJcogaBVhyBuMANGHgOv5O3lzFY= 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=FMq+QXJOvWLzBsl7AQWr9y7MRNw=; b=kYoeaFCvCuRWBX4o008g 5tvlKqcKnw8u05gNtxMmfb96Fdm6H4ah9IH49VVX4z2BEPoyUSfvLGlfSTJGsxNR vGL+T6smbuEqw/CSwYUz9IYySvg92CVI2w9tM1GGZCubSpsfP8CAkNPi/0YEtAjL t0M2kCRJqEPs8akPJyOEfjs= Received: (qmail 31040 invoked by alias); 23 Jun 2014 22:12:48 -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 30996 invoked by uid 89); 23 Jun 2014 22:12:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 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, 23 Jun 2014 22:12:44 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5NMCgmB009786 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jun 2014 18:12:42 -0400 Received: from localhost (vpn1-7-131.ams2.redhat.com [10.36.7.131]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5NMCfsQ014039; Mon, 23 Jun 2014 18:12:42 -0400 Date: Mon, 23 Jun 2014 23:12:41 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [patch] fix namespaces for std::experimental types Message-ID: <20140623221241.GH8592@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) The current Fundamentals TS says any, optional and string_view should be in an inline namespace called fundamentals_v1. Tested x86_64-linux, committed to trunk. commit 3b316b60d21ea224c56bb23a8e1afb06e2277cf8 Author: Jonathan Wakely Date: Mon Jun 23 21:34:29 2014 +0100 * include/experimental/any (any_v1): Rename namespace to fundamentals_v1. Change string returned by bad_any_cast::what(). * include/experimental/optional (fundamentals_v1): Add namespace. * include/experimental/string_view (fundamentals_v1): Likewise. * testsuite/experimental/any/typedefs.cc: New. * testsuite/experimental/optional/typedefs.cc: New. * testsuite/experimental/string_view/typedefs.cc: New. diff --git a/libstdc++-v3/include/experimental/any b/libstdc++-v3/include/experimental/any index 1e8d9b2..643fc23 100644 --- a/libstdc++-v3/include/experimental/any +++ b/libstdc++-v3/include/experimental/any @@ -47,7 +47,7 @@ namespace std _GLIBCXX_VISIBILITY(default) { namespace experimental { -inline namespace any_v1 +inline namespace fundamentals_v1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -68,7 +68,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class bad_any_cast : public bad_cast { public: - virtual const char* what() const noexcept { return "bad_any_cast"; } + virtual const char* what() const noexcept { return "bad any_cast"; } }; [[gnu::noreturn]] inline void __throw_bad_any_cast() @@ -604,7 +604,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // @} group any _GLIBCXX_END_NAMESPACE_VERSION -} // namespace any_v1 +} // namespace fundamentals_v1 } // namespace experimental } // namespace std diff --git a/libstdc++-v3/include/experimental/optional b/libstdc++-v3/include/experimental/optional index 2a3f29d..c68d7ea 100644 --- a/libstdc++-v3/include/experimental/optional +++ b/libstdc++-v3/include/experimental/optional @@ -52,6 +52,8 @@ namespace std _GLIBCXX_VISIBILITY(default) { namespace experimental { +inline namespace fundamentals_v1 +{ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** @@ -797,6 +799,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // @} group optional _GLIBCXX_END_NAMESPACE_VERSION +} // namespace fundamentals_v1 } // [X.Y.12] diff --git a/libstdc++-v3/include/experimental/string_view b/libstdc++-v3/include/experimental/string_view index b54c9e8..4b1a107 100644 --- a/libstdc++-v3/include/experimental/string_view +++ b/libstdc++-v3/include/experimental/string_view @@ -46,6 +46,8 @@ namespace std _GLIBCXX_VISIBILITY(default) { namespace experimental { +inline namespace fundamentals_v1 +{ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** @@ -582,6 +584,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif _GLIBCXX_END_NAMESPACE_VERSION +} // namespace fundamentals_v1 } // namespace experimental diff --git a/libstdc++-v3/testsuite/experimental/any/typedefs.cc b/libstdc++-v3/testsuite/experimental/any/typedefs.cc new file mode 100644 index 0000000..a3f364d --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/any/typedefs.cc @@ -0,0 +1,30 @@ +// { dg-options "-std=gnu++14" } +// { dg-do compile } + +// Copyright (C) 2014 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a moved_to of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +using check1_t = std::experimental::fundamentals_v1::any; +using check2_t = std::experimental::fundamentals_v1::bad_any_cast; + +static_assert(std::is_base_of::value, + "bad_any_cast must derive from bad_cast"); + diff --git a/libstdc++-v3/testsuite/experimental/optional/typedefs.cc b/libstdc++-v3/testsuite/experimental/optional/typedefs.cc new file mode 100644 index 0000000..2dee878 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/optional/typedefs.cc @@ -0,0 +1,33 @@ +// { dg-options "-std=gnu++14" } +// { dg-do compile } + +// Copyright (C) 2014 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a moved_to of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +template + using check1_t = std::experimental::fundamentals_v1::optional; + +using check2_t = std::experimental::fundamentals_v1::in_place_t; +using check3_t = std::experimental::fundamentals_v1::nullopt_t; +using check4_t = std::experimental::fundamentals_v1::bad_optional_access; + +static_assert(std::is_base_of::value, + "bad_optional_access must derive from logic_error"); diff --git a/libstdc++-v3/testsuite/experimental/string_view/typedefs.cc b/libstdc++-v3/testsuite/experimental/string_view/typedefs.cc new file mode 100644 index 0000000..f148a17 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/string_view/typedefs.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=gnu++14" } +// { dg-do compile } + +// Copyright (C) 2014 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a moved_to of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +template + using check1_t = std::experimental::fundamentals_v1::basic_string_view; + +using check2_t = std::experimental::fundamentals_v1::string_view; + +#ifdef _GLIBCXX_USE_C99_STDINT_TR1 +using check3_t = std::experimental::fundamentals_v1::u16string_view; +using check4_t = std::experimental::fundamentals_v1::u32string_view; +#endif + +#ifdef _GLIBCXX_USE_WCHAR_T +using check5_t = std::experimental::fundamentals_v1::wstring_view; +#endif +