https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89640
--- Comment #2 from Mathias Stearn <redbeard0531 at gmail dot com> --- Unfortunately the c++ attributes syntax applies to the lambda type rather than the function, so the warning is correct. The old style __attribute__ syntax seems to be the only way to annotate the lambda function, which is why we use it here. We use something like this in a macro around code that builds error messages on our error paths, which is why it needs to be on a lambda. It made a notable shrink to the size of our primary .text section moving that stuff out to the .text.cold section.