https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79502
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 40735 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40735&action=edit gcc7-pr79502.patch Untested fix. The bug as I see is that we don't actually propagate the attributes from template to its instantiations, except for non-dependent enum.