Fix an ICE on diagnostics originating in external macros

Closes #14091.