[{"id":1767953,"web_url":"http://patchwork.ozlabs.org/comment/1767953/","msgid":"<20170913145546.GY4582@redhat.com>","list_archive_url":null,"date":"2017-09-13T14:55:46","subject":"Re: [PATCH] PR libstdc++/81468 constrain std::chrono::time_point\n\tconstructor","submitter":{"id":48004,"url":"http://patchwork.ozlabs.org/api/people/48004/","name":"Jonathan Wakely","email":"jwakely@redhat.com"},"content":"On 13/09/17 15:09 +0100, Jonathan Wakely wrote:\n>Howard reported this bug, caused by a missing SFINAE constraint on a\n>std::chrono::time_point constructor.\n>\n>I've also done a bit of simplification using alias templates.\n\nHere's the backport for the branches, which just adds the constraint\n(and tests) without the new alias templates.\ncommit 4a6c846f3203dd0ceb13b7130e686833a4150d96\nAuthor: Jonathan Wakely <jwakely@redhat.com>\nDate:   Wed Sep 13 15:16:31 2017 +0100\n\n    PR libstdc++/81468 constrain std::chrono::time_point constructor\n    \n            PR libstdc++/81468\n            * include/std/chrono (time_point(const time_point<_Dur2>&)): Add\n            missing constraint from LWG DR 1177.\n            * testsuite/20_util/duration/cons/dr1177.cc: New.\n            * testsuite/20_util/time_point/cons/81468.cc: New.\n            * testsuite/20_util/duration/literals/range.cc: Update dg-error line.\n\ndiff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono\nindex c3a6ba8f873..cc63d44657b 100644\n--- a/libstdc++-v3/include/std/chrono\n+++ b/libstdc++-v3/include/std/chrono\n@@ -622,7 +622,8 @@ _GLIBCXX_END_NAMESPACE_VERSION\n \t{ }\n \n \t// conversions\n-\ttemplate<typename _Dur2>\n+\ttemplate<typename _Dur2,\n+\t\t typename = _Require<is_convertible<_Dur2, _Dur>>>\n \t  constexpr time_point(const time_point<clock, _Dur2>& __t)\n \t  : __d(__t.time_since_epoch())\n \t  { }\ndiff --git a/libstdc++-v3/testsuite/20_util/duration/cons/dr1177.cc b/libstdc++-v3/testsuite/20_util/duration/cons/dr1177.cc\nnew file mode 100644\nindex 00000000000..28c881ccc79\n--- /dev/null\n+++ b/libstdc++-v3/testsuite/20_util/duration/cons/dr1177.cc\n@@ -0,0 +1,41 @@\n+// Copyright (C) 2017 Free Software Foundation, Inc.\n+//\n+// This file is part of the GNU ISO C++ Library.  This library is free\n+// software; you can redistribute it and/or modify it under the\n+// terms of the GNU General Public License as published by the\n+// Free Software Foundation; either version 3, or (at your option)\n+// any later version.\n+\n+// This library is distributed in the hope that it will be useful,\n+// but WITHOUT ANY WARRANTY; without even the implied warranty of\n+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+// GNU General Public License for more details.\n+\n+// You should have received a copy of the GNU General Public License along\n+// with this library; see the file COPYING3.  If not see\n+// <http://www.gnu.org/licenses/>.\n+\n+// { dg-do compile { target c++11 } }\n+\n+#include <chrono>\n+#include <type_traits>\n+\n+using namespace std;\n+using namespace std::chrono;\n+\n+// DR 1177\n+static_assert(is_constructible<duration<float>, duration<double>>{},\n+    \"can convert duration with one floating point rep to another\");\n+static_assert(is_constructible<duration<float>, duration<int>>{},\n+    \"can convert duration with integral rep to one with floating point rep\");\n+static_assert(!is_constructible<duration<int>, duration<float>>{},\n+    \"cannot convert duration with floating point rep to one with integral rep\");\n+static_assert(is_constructible<duration<int>, duration<long>>{},\n+    \"can convert duration with one integral rep to another\");\n+\n+static_assert(!is_constructible<duration<int>, duration<int, ratio<2,3>>>{},\n+    \"cannot convert duration to one with different period\");\n+static_assert(is_constructible<duration<float>, duration<int, ratio<2,3>>>{},\n+    \"unless it has a floating-point representation\");\n+static_assert(is_constructible<duration<float>, duration<int, ratio<1,3>>>{},\n+    \"or a period that is an integral multiple of the original\");\ndiff --git a/libstdc++-v3/testsuite/20_util/duration/literals/range.cc b/libstdc++-v3/testsuite/20_util/duration/literals/range.cc\nindex c0d1a6e5885..531b53c42ec 100644\n--- a/libstdc++-v3/testsuite/20_util/duration/literals/range.cc\n+++ b/libstdc++-v3/testsuite/20_util/duration/literals/range.cc\n@@ -26,6 +26,6 @@ test01()\n \n   // std::numeric_limits<int64_t>::max() == 9223372036854775807;\n   auto h = 9223372036854775808h;\n-  // { dg-error \"cannot be represented\" \"\" { target *-*-* } 892 }\n+  // { dg-error \"cannot be represented\" \"\" { target *-*-* } 893 }\n }\n // { dg-prune-output \"in constexpr expansion\" } // needed for -O0\ndiff --git a/libstdc++-v3/testsuite/20_util/time_point/cons/81468.cc b/libstdc++-v3/testsuite/20_util/time_point/cons/81468.cc\nnew file mode 100644\nindex 00000000000..30d1c4a5ac7\n--- /dev/null\n+++ b/libstdc++-v3/testsuite/20_util/time_point/cons/81468.cc\n@@ -0,0 +1,34 @@\n+// Copyright (C) 2017 Free Software Foundation, Inc.\n+//\n+// This file is part of the GNU ISO C++ Library.  This library is free\n+// software; you can redistribute it and/or modify it under the\n+// terms of the GNU General Public License as published by the\n+// Free Software Foundation; either version 3, or (at your option)\n+// any later version.\n+\n+// This library is distributed in the hope that it will be useful,\n+// but WITHOUT ANY WARRANTY; without even the implied warranty of\n+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+// GNU General Public License for more details.\n+\n+// You should have received a copy of the GNU General Public License along\n+// with this library; see the file COPYING3.  If not see\n+// <http://www.gnu.org/licenses/>.\n+\n+// { dg-do compile { target c++11 } }\n+\n+#include <chrono>\n+#include <type_traits>\n+\n+using namespace std;\n+using namespace std::chrono;\n+\n+template <class Duration>\n+    using sys_time = time_point<system_clock, Duration>;\n+\n+static_assert(is_constructible<sys_time<milliseconds>, sys_time<seconds>>{},\n+    \"Can construct time_point from one with lower precision duration\");\n+\n+// PR libstdc++/81468 - DR 1177\n+static_assert(!is_constructible<sys_time<seconds>, sys_time<milliseconds>>{},\n+    \"Cannot construct time_point from one with higher precision duration\");","headers":{"Return-Path":"<gcc-patches-return-462041-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-462041-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"RX4OhE1N\"; dkim-atps=neutral","sourceware.org; auth=none","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jwakely@redhat.com"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xsl971KCjz9s06\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 00:56:10 +1000 (AEST)","(qmail 81408 invoked by alias); 13 Sep 2017 14:55:51 -0000","(qmail 81376 invoked by uid 89); 13 Sep 2017 14:55:51 -0000","from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tWed, 13 Sep 2017 14:55:49 +0000","from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com\n\t[10.5.11.13])\t(using TLSv1.2 with cipher AECDH-AES256-SHA\n\t(256/256 bits))\t(No client certificate requested)\tby\n\tmx1.redhat.com (Postfix) with ESMTPS id EF91A267C1;\n\tWed, 13 Sep 2017 14:55:47 +0000 (UTC)","from localhost (unknown [10.33.36.37])\tby smtp.corp.redhat.com\n\t(Postfix) with ESMTP id 9E12C1822A;\n\tWed, 13 Sep 2017 14:55:47 +0000 (UTC)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:subject:message-id:references:mime-version:content-type\n\t:in-reply-to; q=dns; s=default; b=NTEsqCX7kb/R0cnxnoYRAhtDV0voB2\n\tUmiA/pPhJLgct97KxQe0JmAj4AZprVpfRJTIc8NSG72+r1jEDjQdGteADxBRjeyX\n\tjMuQKEYWcey4At+y5si9/rxZhHS+EWeCZt+IU0NKK1SE1mR9rPfMZUF1jj40ZI9q\n\tL79b58W1+d+2I=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:subject:message-id:references:mime-version:content-type\n\t:in-reply-to; s=default; bh=N6AJqtbm7gazpNDLNN0NqeneR1U=; b=RX4O\n\thE1NWqfFAU7VigvZ0c4bCRkt/Ox3pQAmkYhJTeR5A32R1uymzcApPFT9vZK+l9Fz\n\trp149cqUaC07jB6m9erx3EUjnl0ltsoMiD9ItKIvHHxhr0EOMWe2cvD21WL7aMUb\n\tAvtfAKVs01NHOUrFrgMcMIug+Q/qQL5+2/3O+Zc=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tKAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD,\n\tSPF_HELO_PASS autolearn=ham version=3.3.2 spammy=","X-Spam-User":"qpsmtpd, 2 recipients","X-HELO":"mx1.redhat.com","DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com EF91A267C1","Date":"Wed, 13 Sep 2017 15:55:46 +0100","From":"Jonathan Wakely <jwakely@redhat.com>","To":"libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org","Subject":"Re: [PATCH] PR libstdc++/81468 constrain std::chrono::time_point\n\tconstructor","Message-ID":"<20170913145546.GY4582@redhat.com>","References":"<20170913140903.GA8606@redhat.com>","MIME-Version":"1.0","Content-Type":"multipart/mixed; boundary=\"ZG5hGh9V5E9QzVHS\"","Content-Disposition":"inline","In-Reply-To":"<20170913140903.GA8606@redhat.com>","X-Clacks-Overhead":"GNU Terry Pratchett","User-Agent":"Mutt/1.8.3 (2017-05-23)"}},{"id":1768273,"web_url":"http://patchwork.ozlabs.org/comment/1768273/","msgid":"<CAPQZVxvC4RvP=hP08QMdrZ4zLzwU2Auz_kvRs3mfNEamo2J-gg@mail.gmail.com>","list_archive_url":null,"date":"2017-09-14T01:30:25","subject":"Re: [PATCH] PR libstdc++/81468 constrain std::chrono::time_point\n\tconstructor","submitter":{"id":70107,"url":"http://patchwork.ozlabs.org/api/people/70107/","name":"Tim Song","email":"t.canens.cpp@gmail.com"},"content":"On Wed, Sep 13, 2017 at 10:55 AM, Jonathan Wakely <jwakely@redhat.com> wrote:\n>\n> +// DR 1177\n> +static_assert(is_constructible<duration<float>, duration<double>>{},\n> +    \"can convert duration with one floating point rep to another\");\n> +static_assert(is_constructible<duration<float>, duration<int>>{},\n> +    \"can convert duration with integral rep to one with floating point rep\");\n> +static_assert(!is_constructible<duration<int>, duration<float>>{},\n> +    \"cannot convert duration with floating point rep to one with integral rep\");\n> +static_assert(is_constructible<duration<int>, duration<long>>{},\n> +    \"can convert duration with one integral rep to another\");\n> +\n> +static_assert(!is_constructible<duration<int>, duration<int, ratio<2,3>>>{},\n> +    \"cannot convert duration to one with different period\");\n> +static_assert(is_constructible<duration<float>, duration<int, ratio<2,3>>>{},\n> +    \"unless it has a floating-point representation\");\n\n\"it\" is a little ambiguous here unless you read the next message's\nmention of \"the original\"...\n\n> +static_assert(is_constructible<duration<float>, duration<int, ratio<1,3>>>{},\n> +    \"or a period that is an integral multiple of the original\");\n\nThis is backwards: duration<Inty, P1> is convertible to duration<Inty,\nP2> iff P1 is an integral multiple of P2, i.e., if the original's\nperiod is an integral multiple of \"its\" period.\n\nThe static assert only passed because duration<float> was used as the\ndestination type (presumably because of a copy/paste error).\n\nTim","headers":{"Return-Path":"<gcc-patches-return-462098-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-462098-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"bN94EwC1\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xt1Fl4xfDz9t2h\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 11:31:06 +1000 (AEST)","(qmail 1106 invoked by alias); 14 Sep 2017 01:30:49 -0000","(qmail 1080 invoked by uid 89); 14 Sep 2017 01:30:49 -0000","from mail-it0-f52.google.com (HELO mail-it0-f52.google.com)\n\t(209.85.214.52) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tThu, 14 Sep 2017 01:30:47 +0000","by mail-it0-f52.google.com with SMTP id v19so1485525ite.0;\n\tWed, 13 Sep 2017 18:30:47 -0700 (PDT)","by 10.79.33.84 with HTTP; Wed, 13 Sep 2017 18:30:25 -0700 (PDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type; q=dns; s=default; b=p54PkZCr1qmOuQW\n\tgwWIKh2l+MdUzO+WUfmyv4tr4/Z5zVLN2sSEXTBQLkTaq6O4LT4AwzCazZegCZjp\n\t29b59hIDOZlQ2JftwQ2ermtytRpkOOCx2A4L/ejaYFXgHJaqHIiHwzoE8MvugX95\n\t43HS3S0jsVSmU0BmkJlAphdIOVcA=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type; s=default; bh=c2fU4o0itXm6iHAaD1ezW\n\tzOtbj0=; b=bN94EwC11FftxSXlLmud4Gw4eshBshYQgCpqDyFyMbGzbkU7NCsy1\n\tr7Pl8ScRCsLL6LiKXOpNrK8cxOL8ak6/QQHPCM7qoCCPalcYEQ8JOsS0gj2x9Vzj\n\t70idxLpKTitFXi2Ewrz0sAB6SAKTjYDoUGwih2z+C50f2gZA8x/Vmk=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-1.4 required=5.0 tests=AWL, BAYES_00,\n\tFREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=no version=3.3.2 spammy=originals,\n\tHx-languages-length:1587, ambiguous","X-Spam-User":"qpsmtpd, 2 recipients","X-HELO":"mail-it0-f52.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=Ft7OyxybKjMZSxjlSgEcFeEWnk6YjgwDjDVpxhcDCGE=;\n\tb=IdK6SzSqJLTTGfpG1zS3Kw96vdK4SfympF8SPhcd2SZ5vl4XF6ycdCuap32S3qIH+7\n\tO6DovC9N61GCHITZN5qmQgPKsEmW+V8kXzG6HaRCBTdCbz352HQl/uSBbUxYoVM/kwyZ\n\tNh4Mqk6lfUJn1nfThSjVyAHzurEl6MQHpSYT7y0242f+lCfPiupTSwGxKw/j0nk8mVnG\n\tLwQ7CSl15nysfmgIcm0NfB0CD3rRmpi2YRvnLYt3LD2eHTgIYan00Xrtp2TW6rJOeALm\n\tUQzaZvM31wbzZhuqXNL03d19faOJqK4ncLVYfDslYZqcZemN0BoghmgNcb97rxgzex5B\n\tzZ+g==","X-Gm-Message-State":"AHPjjUiDNmm3ThNVTxT+fUaIKvJBHD5sLvai/ytHR55BHJIeYbJTS/05\t++cnpOqgpKgiLBnZv9tLAHkPtcu4oxK5pEs8fkk=","X-Google-Smtp-Source":"AOwi7QBSYmXaRhY7zXGc62OZTYRJETRU8Uu8pdWSOxxyjW87Rh/bCAM1CKK7EVmieemz82aozVyxiYRh5ixrI7RfJUE=","X-Received":"by 10.36.204.86 with SMTP id x83mr903109itf.125.1505352645958;\n\tWed, 13 Sep 2017 18:30:45 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<20170913145546.GY4582@redhat.com>","References":"<20170913140903.GA8606@redhat.com>\n\t<20170913145546.GY4582@redhat.com>","From":"Tim Song <t.canens.cpp@gmail.com>","Date":"Wed, 13 Sep 2017 21:30:25 -0400","Message-ID":"<CAPQZVxvC4RvP=hP08QMdrZ4zLzwU2Auz_kvRs3mfNEamo2J-gg@mail.gmail.com>","Subject":"Re: [PATCH] PR libstdc++/81468 constrain std::chrono::time_point\n\tconstructor","To":"Jonathan Wakely <jwakely@redhat.com>","Cc":"\"libstdc++\" <libstdc++@gcc.gnu.org>,\n\tgcc-patches <gcc-patches@gcc.gnu.org>","Content-Type":"text/plain; charset=\"UTF-8\"","X-IsSubscribed":"yes"}},{"id":1770458,"web_url":"http://patchwork.ozlabs.org/comment/1770458/","msgid":"<20170918200038.GJ4582@redhat.com>","list_archive_url":null,"date":"2017-09-18T20:00:38","subject":"Re: [PATCH] PR libstdc++/81468 constrain std::chrono::time_point\n\tconstructor","submitter":{"id":48004,"url":"http://patchwork.ozlabs.org/api/people/48004/","name":"Jonathan Wakely","email":"jwakely@redhat.com"},"content":"On 13/09/17 21:30 -0400, Tim Song wrote:\n>On Wed, Sep 13, 2017 at 10:55 AM, Jonathan Wakely <jwakely@redhat.com> wrote:\n>>\n>> +// DR 1177\n>> +static_assert(is_constructible<duration<float>, duration<double>>{},\n>> +    \"can convert duration with one floating point rep to another\");\n>> +static_assert(is_constructible<duration<float>, duration<int>>{},\n>> +    \"can convert duration with integral rep to one with floating point rep\");\n>> +static_assert(!is_constructible<duration<int>, duration<float>>{},\n>> +    \"cannot convert duration with floating point rep to one with integral rep\");\n>> +static_assert(is_constructible<duration<int>, duration<long>>{},\n>> +    \"can convert duration with one integral rep to another\");\n>> +\n>> +static_assert(!is_constructible<duration<int>, duration<int, ratio<2,3>>>{},\n>> +    \"cannot convert duration to one with different period\");\n>> +static_assert(is_constructible<duration<float>, duration<int, ratio<2,3>>>{},\n>> +    \"unless it has a floating-point representation\");\n>\n>\"it\" is a little ambiguous here unless you read the next message's\n>mention of \"the original\"...\n>\n>> +static_assert(is_constructible<duration<float>, duration<int, ratio<1,3>>>{},\n>> +    \"or a period that is an integral multiple of the original\");\n>\n>This is backwards: duration<Inty, P1> is convertible to duration<Inty,\n>P2> iff P1 is an integral multiple of P2, i.e., if the original's\n>period is an integral multiple of \"its\" period.\n>\n>The static assert only passed because duration<float> was used as the\n>destination type (presumably because of a copy/paste error).\n>\n>Tim\n\nGood catch, thanks.\n\nI've committed this patch.\ncommit 5c021e19e0758e5ad7e47feadbd0632b15f85785\nAuthor: Jonathan Wakely <jwakely@redhat.com>\nDate:   Mon Sep 18 19:04:25 2017 +0100\n\n    PR libstdc++/81468 fix test for duration conversions\n    \n            PR libstdc++/81468\n            * testsuite/20_util/duration/cons/dr1177.cc: Fix incorrect test and\n            improve static assertion messages.\n\ndiff --git a/libstdc++-v3/testsuite/20_util/duration/cons/dr1177.cc b/libstdc++-v3/testsuite/20_util/duration/cons/dr1177.cc\nindex 28c881ccc79..d90cd27f482 100644\n--- a/libstdc++-v3/testsuite/20_util/duration/cons/dr1177.cc\n+++ b/libstdc++-v3/testsuite/20_util/duration/cons/dr1177.cc\n@@ -36,6 +36,6 @@ static_assert(is_constructible<duration<int>, duration<long>>{},\n static_assert(!is_constructible<duration<int>, duration<int, ratio<2,3>>>{},\n     \"cannot convert duration to one with different period\");\n static_assert(is_constructible<duration<float>, duration<int, ratio<2,3>>>{},\n-    \"unless it has a floating-point representation\");\n-static_assert(is_constructible<duration<float>, duration<int, ratio<1,3>>>{},\n-    \"or a period that is an integral multiple of the original\");\n+    \"... unless the result type has a floating-point representation\");\n+static_assert(is_constructible<duration<int, ratio<1,3>>, duration<int>>{},\n+    \"... or the original's period is a multiple of the result's period\");","headers":{"Return-Path":"<gcc-patches-return-462435-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-462435-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"H1e0fxBU\"; dkim-atps=neutral","sourceware.org; auth=none","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jwakely@redhat.com"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xwxhc0zBdz9s8J\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 19 Sep 2017 06:01:03 +1000 (AEST)","(qmail 51074 invoked by alias); 18 Sep 2017 20:00:42 -0000","(qmail 50939 invoked by uid 89); 18 Sep 2017 20:00:41 -0000","from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tMon, 18 Sep 2017 20:00:40 +0000","from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com\n\t[10.5.11.13])\t(using TLSv1.2 with cipher AECDH-AES256-SHA\n\t(256/256 bits))\t(No client certificate requested)\tby\n\tmx1.redhat.com (Postfix) with ESMTPS id 255DB285B5;\n\tMon, 18 Sep 2017 20:00:39 +0000 (UTC)","from localhost (unknown [10.33.36.48])\tby smtp.corp.redhat.com\n\t(Postfix) with ESMTP id CCDA76062F;\n\tMon, 18 Sep 2017 20:00:38 +0000 (UTC)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:references:mime-version\n\t:content-type:in-reply-to; q=dns; s=default; b=NLSESGgm+HqKugWac\n\t+BDO71JXLSZZs2JaCdXevC4IXwmEEnTde8BhcuLyHglYvnlNUlbKwA+9TpWPEvS6\n\t0gjwUgTJlOkzfl5h8nYdcn23juCsgMWvaXT8KHtUNXPRymh4u64fF3CzhI746hjR\n\tbzdNE6CBosKcH23lp6dhGumkl8=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:references:mime-version\n\t:content-type:in-reply-to; s=default; bh=Yi7IVG6+Gp696awFHpzHoP5\n\tEk8I=; b=H1e0fxBUktnp+sWc+uTAzVpFFVNdftu4ppDt8qxQBOa2blCpMcGW1vB\n\tCqN12WdEHcuF6YmK98NpSl6WteSSddVfd88AteeFGvU8Hgj5sHseHQbSM2v91KfQ\n\t+wxUPOgRW/OM9Tqf4UaBZhgreRVofkmcvfOFgNVH9meJJMJuy+fw=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD,\n\tSPF_HELO_PASS autolearn=ham version=3.3.2 spammy=","X-Spam-User":"qpsmtpd, 2 recipients","X-HELO":"mx1.redhat.com","DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 255DB285B5","Date":"Mon, 18 Sep 2017 21:00:38 +0100","From":"Jonathan Wakely <jwakely@redhat.com>","To":"Tim Song <t.canens.cpp@gmail.com>","Cc":"libstdc++ <libstdc++@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org>","Subject":"Re: [PATCH] PR libstdc++/81468 constrain std::chrono::time_point\n\tconstructor","Message-ID":"<20170918200038.GJ4582@redhat.com>","References":"<20170913140903.GA8606@redhat.com>\n\t<20170913145546.GY4582@redhat.com>\n\t<CAPQZVxvC4RvP=hP08QMdrZ4zLzwU2Auz_kvRs3mfNEamo2J-gg@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"multipart/mixed; boundary=\"MSd2ShuMixI0uVaZ\"","Content-Disposition":"inline","In-Reply-To":"<CAPQZVxvC4RvP=hP08QMdrZ4zLzwU2Auz_kvRs3mfNEamo2J-gg@mail.gmail.com>","X-Clacks-Overhead":"GNU Terry Pratchett","User-Agent":"Mutt/1.8.3 (2017-05-23)"}}]