On Wed, 24 Jan 2024 at 17:27, Jonathan Wakely <jwak...@redhat.com> wrote:
>
> On Wed, 24 Jan 2024 at 15:24, Patrick Palka <ppa...@redhat.com> wrote:
> >
> > On Wed, 24 Jan 2024, Jonathan Wakely wrote:
> >
> > > On Tue, 23 Jan 2024 at 23:54, Patrick Palka wrote:
> > > > @@ -1016,10 +1116,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> > > >         tuple(const pair<_U1, _U2>&&) = delete;
> > > >  #endif // C++23
> > > >
> > > > -#if 0 && __cpp_lib_tuple_like // >= C++23
> > > > -      template<__tuple_like _UTuple>
> > > > -       constexpr explicit(...)
> > > > -       tuple(_UTuple&& __u);
> > > > +#if __cpp_lib_tuple_like // >= C++23
> > > > +      template<__eligible_tuple_like<tuple> _UTuple>
> > > > +       requires (__constructible_from_tuple_like<_UTuple>())
> > > > +         && (!__use_other_ctor<_UTuple>())
> > > > +       constexpr explicit(!__convertible_from_tuple_like<_UTuple>())
> > > > +       tuple(_UTuple&& __u)
> > > > +       : _Inherited(__tuple_like_tag_t{},
> > > > +                    std::forward<_UTuple>(__u),
> > > > +                    make_index_sequence<sizeof...(_Elements)>{})
> > > > +       { }
> > > >  #endif // C++23
> > > >
> > > >        // Allocator-extended constructors.
> > > > @@ -1202,10 +1308,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> > > >         tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&&) = 
> > > > delete;
> > > >  #endif // C++23
> > > >
> > > > -#if 0 && __cpp_lib_tuple_like // >= C++23
> > > > -      template<typename _Alloc, __tuple_like _UTuple>
> > > > -       constexpr explicit(...)
> > > > -       tuple(allocator_arg_t __tag, const _Alloc& __a, _UTuple&& __u);
> > > > +#if __cpp_lib_tuple_like // >= C++23
> > > > +      template<typename _Alloc, __eligible_tuple_like<tuple> _UTuple>
> > > > +       requires (__constructible_from_tuple_like<_UTuple>())
> > > > +         && (!__use_other_ctor<_UTuple>())
> > > > +       constexpr explicit(!__convertible_from_tuple_like<_UTuple>())
> > > > +       tuple(allocator_arg_t __tag, const _Alloc& __a, _UTuple&& __u)
> > > > +       : _Inherited(__tuple_like_tag_t{},
> > > > +                    __tag, __a, std::forward<_UTuple>(__u),
> > > > +                    make_index_sequence<sizeof...(_Elements)>{})
> > > > +       { }
> > > >  #endif // C++23
> > >
> > > For some reason these two new constructors aren't deleted if they
> > > create dangling refs. I don't know why.
> >
> > Hmm, seems like an oversight.  Shall we proactively implement them?
>
> Yes, I think so. I can't see why we would want to permit a dangling
> reference there.
>
> e.g.
> std::array<long, 1> a{};
> std::tuple<const int&> t(a);

This is now https://cplusplus.github.io/LWG/issue4045

Reply via email to