https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78216
--- Comment #5 from Adam Ryan <gcc.gnu.org at ajryansolutions dot co.uk> --- I should the patch only allows the code snippet I posted to compile, the code from the original poster has a different exception however I think the eventual solution may be common to both.