public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: Jason Merrill <jason@redhat.com>, gcc Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] c++: Add C++23 consteval if support - P1938R3 [PR100974]
Date: Thu, 10 Jun 2021 12:34:34 +0200	[thread overview]
Message-ID: <20210610103434.GE7746@tucnak> (raw)
In-Reply-To: <CACb0b4=i+U+5xyBREbSdxr93zAzUrjwO1S3RvopmN+F9W9OEvw@mail.gmail.com>

On Thu, Jun 10, 2021 at 11:24:43AM +0100, Jonathan Wakely wrote:
> > And I'm not changing the libstdc++ side, where perhaps we could change
> > std::is_constant_evaluated definition for
> > #ifdef __cpp_if_consteval
> > case to if consteval { return true; } else { return false; }
> > but we need to keep it defined to __builtin_is_constant_evaluated ()
> > for C++20 or older.
> 
> Is there any advantage to changing that (cheaper for GCC to evaluate?)

I guess compile-time lost in the noise.

> or should we just continue to use the __builtin unconditionally?
> 
> I suppose it's theoretically possible that there could be a non-GCC
> compiler where defined(__cpp_if_consteval) is true but
> __has_builtin(__builtin_is_constant_evaluated) is false.

Up to you.  The wording says Equivalent to
if consteval { return true; } else { return false; }
and return __builtin_is_constant_evaluated (); is equivalent to that.

Perhaps some people could appreciate to see it literally there, but we
can't use it for C++20 (due to the -Wpedantic warnings or -pedantic-errors
errors) and for C++17 and earlier (consteval is not a keyword).

	Jakub


  reply	other threads:[~2021-06-10 10:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  8:34 Jakub Jelinek
2021-06-10 10:24 ` Jonathan Wakely
2021-06-10 10:34   ` Jakub Jelinek [this message]
2021-06-10 10:43     ` Jonathan Wakely
2021-06-10 14:09 ` Jason Merrill
2021-06-10 14:44   ` Jakub Jelinek
2021-06-10 17:25     ` Jakub Jelinek
2021-06-10 19:00     ` Jason Merrill
2021-06-11 10:28       ` [PATCH v2] " Jakub Jelinek
2021-06-11 12:49         ` Jason Merrill

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=20210610103434.GE7746@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=jwakely@redhat.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).