On 8/17/26 3:39 PM, Jason Merrill wrote:
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
I pushed this with that change.

Jason

Reply via email to