Add regression test for PR12331.