https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118670
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Jeremy R. from comment #3) > Thanks Andrew, > Two thoughts: > Firstly, I'm surprised to see a normal reference and a > std::reference_wrapper behaving differently for this diagnostic. What's the > reason for this being intentional? Yes it is intentional because we can see the reference to a string when using an explicity reference but with std::reference_wrapper it is hidden out of the compiler really. > Secondly, would it make sense to mention gnu::no_dangling in the > -Wdangling-reference diagnostic message? Not really, since GCC documentation for -Wdangling-reference references it already. And for diagnostics (with -fdiagnostics-urls=always or in a supporting console) will put add an URL link to the screen for the documentation.