From patchwork Fri Mar 27 12:45:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 455403 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 525321400DE for ; Fri, 27 Mar 2015 23:45:47 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=TEsDq+hJ; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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=LnvZMGKrw2YGefEIu4w1PJpUAtXk0A3rQY0zV2YzZ/WhBblaPLQ04 JsKj95H+9Tj1CvjSXznJLbRg2Xd1OPUH4+AAQ3ZOYR4HAdkWAULBp0QxihMYlKJO ThJeyMPpMbLD32DW7IvPakMgnlUtbxkThtkcoTaIx+l8jbMQ4NWdbE= 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=YHHES0n0Hy/bBYMEYada09lRShI=; b=TEsDq+hJGO6V+wjc9ufp v81MNGWMI6K2NkXAhFsUuYkkeoMm54q+qcwy6XAzy8OV/IEQwRFfpynGhb6vQDvm AgiKf9IyzT16gS1hsEKKuo53S8tzJeJz/ttsPhY9TNAz4xunE5myQrGN1zN1eRcU ViuDByzoSsgV3GDQ9BwTA4k= 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-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 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:19 +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-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) 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. 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;