From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 97240 invoked by alias); 27 Mar 2015 12:45:28 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 97182 invoked by uid 89); 27 Mar 2015 12:45:23 -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; Fri, 27 Mar 2015 12:45:22 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2RCjKZ6012617 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 27 Mar 2015 08:45:20 -0400 Received: from localhost (ovpn-116-96.ams2.redhat.com [10.36.116.96]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2RCjJVY024856; Fri, 27 Mar 2015 08:45:20 -0400 Date: Fri, 27 Mar 2015 12:45:00 -0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [patch] libstdc++/65499 make duration literals visible in std::chrono namespace Message-ID: <20150327124519.GO9755@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="uGrbifh0UoBBidu/" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-03/txt/msg01436.txt.bz2 --uGrbifh0UoBBidu/ Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-length: 252 This is a tiny tweak to add a missing piece of C++14 support, the duration literals should be usable via "using namespace std::chrono". It doesn't affect anything in C++03 or C++11 mode so safe for trunk now. Tested x86_64-linux, committed to trunk. --uGrbifh0UoBBidu/ Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" Content-length: 2037 commit 907f5e128d855d339829abbd1d314f382e3ae6fc Author: Jonathan Wakely Date: Thu Mar 26 20:12:36 2015 +0000 PR libstdc++/65499 * include/std/chrono: Add using-directive for literals to std::chrono. * testsuite/20_util/duration/literals/65499.cc: New. diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono index e5baa56..50a2bbf 100644 --- a/libstdc++-v3/include/std/chrono +++ b/libstdc++-v3/include/std/chrono @@ -866,6 +866,15 @@ _GLIBCXX_END_NAMESPACE_VERSION } // inline namespace chrono_literals } // inline namespace literals + namespace chrono + { + _GLIBCXX_BEGIN_NAMESPACE_VERSION + + using namespace literals::chrono_literals; + + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace chrono + #endif // __cplusplus > 201103L // @} group chrono diff --git a/libstdc++-v3/testsuite/20_util/duration/literals/65499.cc b/libstdc++-v3/testsuite/20_util/duration/literals/65499.cc new file mode 100644 index 0000000..62c4f5a --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/duration/literals/65499.cc @@ -0,0 +1,26 @@ +// Copyright (C) 2015 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 copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-options "-std=gnu++14" } +// { dg-do compile } + +// PR libstdc++/65499 + +#include + +using namespace std::chrono; +minutes min = 36min; --uGrbifh0UoBBidu/--