This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH for c++/91428 - warn about std::is_constant_evaluated in if constexpr
- From: Jason Merrill <jason at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 27 Aug 2019 21:53:37 -0400
- Subject: Re: C++ PATCH for c++/91428 - warn about std::is_constant_evaluated in if constexpr
- References: <20190827215000.GF14737@redhat.com>
On Tue, Aug 27, 2019 at 5:50 PM Marek Polacek <polacek@redhat.com> wrote:
>
> As discussed in 91428 and in
> <https://stackoverflow.com/questions/54251530/stdis-constant-evaluated-behavior>,
>
> if constexpr (std::is_constant_evaluated ())
> // ...
> else
> // ...
>
> always evaluates the true branch. Someone in the SO post said "But hopefully
> compilers will just diagnose that case" so I'm adding a warning.
>
> I didn't want to invent a completely new warning so I'm tagging along
> -Wtautological-compare.
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
OK.
Jason