This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] PR libstdc++/80939 Remove unmeetable constexpr specifiers
- From: Tim Song <t dot canens dot cpp at gmail dot com>
- To: Tim Shen <timshen at google dot com>
- Cc: Jonathan Wakely <jwakely at redhat dot com>, "libstdc++" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 2 Jun 2017 15:39:52 -0400
- Subject: Re: [PATCH] PR libstdc++/80939 Remove unmeetable constexpr specifiers
- Authentication-results: sourceware.org; auth=none
- References: <20170602130734.GA6233@redhat.com> <CAG4ZjN=0A_7LDVudhxin6VP0b5mCO1QuXt9No2Kcu+vvkLS4tg@mail.gmail.com>
On Fri, Jun 2, 2017 at 3:19 PM, Tim Shen <timshen@google.com> wrote:
> On Fri, Jun 2, 2017 at 6:07 AM, Jonathan Wakely wrote:
>> As the PR points out, we aren't qualifying calls to __ref_cast, and
>> have 'constexpr' on function templates that can never be usable in
>> constant expressions.
>
> Apology for the constexpr trolling, but that was not intentional. :)
>
> I'm curious why no tests break. Is it because constexpr in a template
> function is a no-op instead of a hard error, when the function
> definition is not constexpr?
>
> The patch looks good.
>
A non-template, non-default constexpr function that can never be used
in a constant expression is ill-formed NDR. ([dcl.constexpr]/5)
A constexpr function template for which no specialization that
satisfies the requirements for a constexpr function (when considered
as a non-template) can be generated is ill-formed NDR.
([dcl.constexpr]/6)
It's not really clear to me whether the second rule incorporates the
first or if it's just talking about the requirements in
[dcl.constexpr]/3, but regardless it's not required to break.