On Fri, May 09, 2025 at 08:18:58AM -0400, Jason Merrill wrote:
> On 4/21/25 6:22 AM, Nathaniel Shead wrote:
> > This call is not necessary, as we don't access the bodies of any classes
> > that we instantiate here.
>
> This turns out to break
>
> 20_util/function_objects/mem_fn/constexpr.cc
> std/ranges/view.cc
>
> when modified to use import std (as attached). For the former, I see
>
> > In file included from
> > /home/jason/s/gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/stdc++.h:55,
> > from
> > /home/jason/s/gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/std.cc:30,
> > of module std, imported at
> > /home/jason/gt/libstdc++-v3/testsuite/20_util/function_objects/mem_fn/constexpr.cc:21:
> > /home/jason/s/gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/functional: In
> > instantiation of ‘class std::_Mem_fn_base<int F::*, false>’:
> > /home/jason/s/gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/functional:211:12:
> > required from ‘struct std::_Mem_fn<int F::*>’
> > 211 | struct _Mem_fn<_Res _Class::*>
> > | ^~~~~~~~~~~~~~~~~~~~~~~
> > /home/jason/gt/libstdc++-v3/testsuite/20_util/function_objects/mem_fn/constexpr.cc:36:21:
> > required from here
> > 36 | return std::mem_fn(&F::i)(f);
> > | ~~~~~~~~~~~^~~~~~~
> > /home/jason/s/gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/functional:190:23:
> > error: conflicting declaration of template ‘template<class _Func, class
> > ... _BoundArgs> struct std::_Bind_check_arity’
> > 190 | friend struct _Bind_check_arity;
> > | ^~~~~~~~~~~~~~~~~
> > /home/jason/s/gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/functional:834:12:
> > note: previous declaration ‘template<class _Func, class ... _BoundArgs>
> > struct std::_Bind_check_arity’
> > 834 | struct _Bind_check_arity { };
> > | ^~~~~~~~~~~~~~~~~
>
> lookup_imported_hidden_friend is failing without the lazy_load_pendings, so
> we try and fail to push the instantiation. Reverting this patch makes them
> pass.
>
> Jason
Interesting, apparently I hadn't tested sufficiently: thanks for this.
I'll reduce a testcase.
Nathaniel