https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115808
--- Comment #6 from linuxnyasha at tutanota dot com --- (In reply to Andrew Pinski from comment #5) > (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. I think the way gcc works with optimizations is more correct. Clang works the same way. My project depends on this, so I would like it to either remain unchanged, or for it to always work as if with optimizations. Well, I consider the way clang works to be a higher priority than msvc.