https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115808
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to linuxnyasha from comment #2) > On clang works But 2 out of 3 compilers have the same error message which might mean this is not valid code. with and without optimizations in GCC in this case usually means it depends on when the decl is injected depending which template gets instantiated first.