public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: gcc-patches@gcc.gnu.org, jakub@redhat.com, richard.sandiford@arm.com
Subject: Re: [PATCH] Remove poly_int_pod
Date: Thu, 28 Sep 2023 13:26:30 -0400	[thread overview]
Message-ID: <8673fdfc-4b16-ff4a-8906-c47403cde825@redhat.com> (raw)
In-Reply-To: <mptil7utye5.fsf@arm.com>

On 9/28/23 05:55, Richard Sandiford wrote:
> poly_int was written before the switch to C++11 and so couldn't
> use explicit default constructors.  This led to an awkward split
> between poly_int_pod and poly_int.  poly_int simply inherited from
> poly_int_pod and added constructors, with the argumentless constructor
> having an empty body.  But inheritance meant that poly_int had to
> repeat the assignment operators from poly_int_pod (again, no C++11,
> so no "using" to inherit base-class implementations).
> 
> All that goes away if we switch to using default constructors.
> 
> The main complication is ensuring that braced initialisation still
> gives a constexpr, so that static variables can be initialised without
> runtime code.  The two problems here are:
> 
> (1) When initialising a poly_int<N, wide_int> with fewer than N
>      coefficients, the other coefficients need to be a zero of
>      the same precision as the explicit coefficients.  This was
>      previously done in a for loop using wi::ints_for<...>::zero,
>      but C++11 constexpr constructors can't have function bodies.
>      The patch instead uses a series of delegated initialisers to
>      fill in the implicit coefficients.

Perhaps it's time to update the bootstrap requirement to C++14 (i.e. GCC 
5, from eight years ago).  Not that this would affect this particular patch.

Jason


  parent reply	other threads:[~2023-09-28 17:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28  9:55 Richard Sandiford
2023-09-28 14:06 ` Jakub Jelinek
2023-09-28 17:26 ` Jason Merrill [this message]
2023-09-28 19:09   ` Jeff Law
2023-09-29  6:31     ` Richard Biener
2023-09-29  8:14       ` Jakub Jelinek
2023-10-02  7:47 ` Jan-Benedict Glaw
2023-10-02  7:50   ` Richard Sandiford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8673fdfc-4b16-ff4a-8906-c47403cde825@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=richard.sandiford@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).