On Fri, 29 May 2020, Jason Merrill wrote: > On 5/22/20 10:56 AM, Patrick Palka wrote: > > On Fri, 22 May 2020, Patrick Palka wrote: > > > > > When comparing two special member function templates to see if one hides > > > the other (as per P0848R3), we need to check satisfaction which we can't > > > do on templates. So this patch makes add_method skip the eligibility > > > test on member function templates and just lets them coexist. > > > > It just occurred to me that this problem isn't limited to member function > > templates. Consider this valid testcase which we currently reject: > > > > template<bool B> struct g { > > g() requires B && false; > > g() requires B; > > }; > > > > g<true> b; // error > > > > During add_method, we check satisfaction of both default constructors, > > and since their constraints are dependent, constraints_satisfied_p > > returns true for both sets of constraints. We then see that > > 'B && false' is more constrained than 'B' and therefore discard the second > > constructor. Since we discarded the second default constructor at > > definition time, the instantiation g<true> has no eligible default > > constructor. > > > > I am not sure what to do from here... > > I looked at this and it seems enough to let the functions coexist without > trying to compare their constraints if processing_template_decl; we'll handle > the hiding properly when the class template is instantiated. > > So this is what I'm committing:
Aha, that makes sense now, thanks! Somehow I convinced myself that during class template instantiation we don't call add_method, so I instead tried to remove that block of code from add_method altogether. Needless to say that didn't work very well..