Re: [PATCH] c++, contracts: Only defer contracts that use an undeduced result binding [PR125537]
Wang Jinghao <[email protected]>
| Newsgroups | gmane.comp.gcc.patches |
|---|---|
| Message-ID | <CAM67yWBBynqaJO1bEfHdmqyyw_sJEUAZxnrgugEHHLwX26KhwQ@mail.gmail.com> |
Hi Jason, Thanks for the review. On Tue, Aug 18, 2026 at 3:39 AM 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. If we also make the condition in cp_parser_late_contract_condition consistent, we could even remove its call to rebuild_postconditions, since the known-type path would no longer create pseudo-templates that require this compensating step. > > 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. > All tests named using PR numbers in these patches will be renamed appropriately in the v2 patches. Best Regards, Jinghao