On Fri, Aug 28, 2026 at 8:54 AM Jason Merrill <[email protected]> wrote:
>
> On 8/23/26 5:22 PM, Wang Jinghao wrote:
> > On Fri, Aug 21, 2026 at 7:56 PM Waffl3x <[email protected]> wrote:
> >>
> >> Iains pointed out this patch to me after I submitted mine. Didn't mean
> >> to duplicate work, sorry!
> > Don't mind :P
> >>
> >> On Monday, August 17th, 2026 at 1:40 PM, Jason Merrill <[email protected]>
> >> wrote:
> >>> On 8/14/26 4:33 PM, Wang Jinghao wrote:
> >>>> For precondition and postcondition without a result binding, whether
> >>>> the return type is auto is irrelevant to the condition expression, so
> >>>> type conversions should be completed immediately.
> >>>>
> >>>> PR c++/125537
> >>>>
> >>>> gcc/cp/ChangeLog:
> >>>>
> >>>> * pt.cc (tsubst_contract): Keep template processing enabled
> >>>> only for postconditions with an undeduced result binding.
> >>>
> >>> Hmm, I notice this is still a different condition from
> >>> cp_parser_late_contract_condition and rebuild_postconditions, which only
> >>> check whether there's a result binding, not whether it's auto. They
> >>> ought to agree on the condition for treating the postcondition as a
> >>> pseudo-template.
> >>
> >> By the time you're in rebuild_postconditions I believe the placeholder
> >> return type is gone. It bails out early 'if the return type is
> >> undeduced', I haven't looked at cp_parser_late_contract_condition
> >> enough though so maybe there are issues on that side.
> >>
> >>>> gcc/testsuite/ChangeLog:
> >>>>
> >>>> * g++.dg/contracts/cpp26/pr125537.C: New test.
> >>>
> >>> Please name tests by what they are testing, not just by PR number. So
> >>> this could be template-post1.C.
> >>>
> >>> Jason
> >>
> >> I guess I'll have to fix my patches as well then.
> > I have a follow up patch that implements this part, perhaps it might
> > be useful to you. This should also be one of the causes of the
> > ICE in PR125574.
> I combined this with the earlier patch and pushed it, like so:
>
> But somehow I didn't notice until after pushing that contracts-class1.C
> was failing with a -Wreturn-type warning. Did you mean for the test to
> be different somehow?
OMG, I’m very sorry, this was a mistake on my part. I forgot to make
the function return true. x_x
>
> Jason