Re: [PATCH] c++, contracts: Always regenerate contracts from the current template pattern [PR125712]
Jason Merrill <[email protected]>
| Newsgroups | gmane.comp.gcc.patches |
|---|---|
| Message-ID | <[email protected]> |
On 8/14/26 4:44 PM, Wang Jinghao wrote: > Bootstrapped/regtested on x86_64-pc-linux-gnu. > > -- >8 -- > > `tsubst_function_decl()' associates uninstantiated contracts with a > function template instantiation. If an explicit instantiation is > encountered before a later redeclaration provides the definition, > those contracts can still refer to PARM_DECLs from the earlier > declaration. > > Therefore, we should always regererate the contracts from the current > code_pattern in `regenerate_decl_from_template()' when either DECL > or pattern has contracts. > > PR c++/125712 > > gcc/cp/ChangeLog: > > * pt.cc (regenerate_decl_from_template): Regenerate contracts > from the current code pattern. > > gcc/testsuite/ChangeLog: > > * g++.dg/contracts/cpp26/pr125712.C: New test. So perhaps specialization1.C Jason