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 Shen via libstdc++" <libstdc++ at gcc dot gnu dot org>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>, Tim Song <t dot canens dot cpp at gmail dot com>
- Date: Fri, 2 Jun 2017 12:19:53 -0700
- Subject: Re: [PATCH] PR libstdc++/80939 Remove unmeetable constexpr specifiers
- Authentication-results: sourceware.org; auth=none
- References: <20170602130734.GA6233@redhat.com>
- Reply-to: Tim Shen <timshen at google dot com>
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.
>
> This fixes it, and also simplifies __variant::__erased_dtor by using
> std::_Destroy, although that requires including quite a lot more code,
> for iterator_traits and allocator_traits. If that matters (probably
> not) then <bits/stl_construct.h> could be split up to move _Construct
> and _Destroy to a new <bits/stl_construct_base.h>. Or maybe I should
> just leave __erased_dtor alone (apart from qualifying the __ref_cast
> call).
>
> Anybody feel strongly either way?
>
> PR libstdc++/80939
> * include/std/variant (__erased_ctor, __erased_assign,
> __erased_swap)
> (__erased_hash): Remove constexpr specifier and qualify calls to
> __ref_cast.
> (__erased_dtor): Remove constexpr specifier and use _Destroy.
>
>
--
Regards,
Tim Shen