Fix gcc bug 58800.

See #2330 for details, except I needed to remove the Changelog change from the patch