From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by sourceware.org (Postfix) with ESMTPS id 0AD3438708C1 for ; Sat, 25 Mar 2023 11:55:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0AD3438708C1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-il1-x12b.google.com with SMTP id e6so2216587ilu.9 for ; Sat, 25 Mar 2023 04:55:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679745347; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=BR5m3hbwFFQa/plhFBTUs/vy78ONWZdmyliEaEpdrO4=; b=bXQVzsiambO6t/uafCZiJHXHakUpDGrRjtT73k2radvAWcl8zvt9OYXne+2FF77Jvp OJujFdXDymANiIYTpcyYUB+KAY+lnm8BjjmKf902MUjJjRSc6Lk1PNl4BumS7g0kkSKA bS0jy9IJtIJWtHYhapgfNmPCo0XQijUbxaqO0u7NiK0QvWyuw/RNCSlWS1PoB1DmaO+1 ksGYEZ6GIG/3p3GoY+yk0oJsV0izUabxoN+AvA360W0THdaRuebf+rMoOhBt+3TMOUv1 /RPTHVPhd9iDAkYgTSw+lB65zQdiYQ0w2q9y1AWXhG7q6YiJfkjSs2vLqq2wgXpdbQ7I WGUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679745347; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BR5m3hbwFFQa/plhFBTUs/vy78ONWZdmyliEaEpdrO4=; b=Ln+70UAaxicADm+M7eUchxe6cWmNiE53voquOTOYaZGccvGemKVrTxqMYWtTOO6lDi rwj15P+8bDyjWTx9sztba69qnwmbhYMtpGpvrkWm7HpzsFPoLJSpxfuimMwlCq0m17eB Cu9xxfk2Wv2uElnwF8djV0uBK3JsDFyWGxI9vXOWbmZ1nMUvAfr/4yAJ+f/mCHEERHP/ 4lsTAFVIizutVXMh00OHBR5aIY/zdlfh1czRRlvpihF5a7pcv9dR5VYklOI23SdLMqbI sRX5oVgiqIQTjmD1X1DHEmXsq/i3GI5lZBKgapQbVXjrM2JIT3E9CQ2I6qM3zU+A7EQp aMPQ== X-Gm-Message-State: AAQBX9fgSBOjYq1bU+/ScwdG5gwEmEoubv7rXYfzeF4x181YuAlZUhud /Pz3UXvPlK7KsuCbOOa+D0bzncOQFVChp6EV4r9RzL3dOoM= X-Google-Smtp-Source: AKy350ZoC62NMKPbMHikfyKD65QV69DCLTHjmiehOu7sPqyToV04ANifLGp1dDEIAatCSNf33qxGjfgO3qT5mdZ4sNA= X-Received: by 2002:a05:6902:1501:b0:b6d:80ab:8bb6 with SMTP id q1-20020a056902150100b00b6d80ab8bb6mr3441297ybu.1.1679743761801; Sat, 25 Mar 2023 04:29:21 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Filippo Bistaffa Date: Sat, 25 Mar 2023 12:29:13 +0100 Message-ID: Subject: Re: float is constructible from double, C++23's std::float13_t is not To: Jonathan Wakely Cc: gcc-help Content-Type: multipart/alternative; boundary="0000000000003c656705f7b7d2d1" X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --0000000000003c656705f7b7d2d1 Content-Type: text/plain; charset="UTF-8" I'm not sure I fully understand that quote: double can be converted to float (even if float has a lower rank) because they are both "standard", whereas the same doesn't apply to std::float16_t? On Fri, Mar 24, 2023, 21:22 Jonathan Wakely wrote: > > > On Fri, 24 Mar 2023, 17:05 Filippo Bistaffa via Gcc-help, < > gcc-help@gcc.gnu.org> wrote: > >> I was playing around with gcc-trunk's support for C++23's std::float13_t >> and I found out that, while float is constructible from double, as far as >> I >> can tell std::float13_t is not. >> In other words, the following code compiles OK: >> >> #include >> #include >> int main() { >> std::vector x(5); >> std::vector y(std::begin(x), std::end(x)); >> } >> >> whereas the following does not: >> >> #include >> #include >> int main() { >> std::vector x(5); >> std::vector y(std::begin(x), std::end(x)); >> } >> >> See this snippet . >> Am I missing something or is it supposed to be like that? >> > > Yes, this is the correct behaviour. The C++23 standard says: > > "A prvalue of floating-point type can be converted to a prvalue of another > floating-point type with a greater or equal conversion rank ([conv.rank] > ). > A prvalue of standard floating-point type can be converted to a prvalue of > another standard floating-point type." > > > > --0000000000003c656705f7b7d2d1--