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