[Bug c++/115987] False "possibly dangling reference" false positive when having an extra template parameter
durosu at yahoo dot com
gcc-bugzilla@gcc.gnu.org
Thu Jul 18 17:06:34 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115987
--- Comment #11 from Dan Urosu <durosu at yahoo dot com> ---
1) "We don't analyze the body of the function"
unwrap_1 and unwrap_2 are functionally equivalent. Yet only unwrap_2 triggers
the warning.
2) If the unwrap_2 is called from a macro, then the pragma suppression does not
work.
If the #pragma GCC diagnostic ignored "-Wdangling-reference" would work in cas
(2) above, we could use it as a band-aid solution.
PS. Also worth mentioning, if you write the non-cost equivalent of the unwrap_2
template function
"T& unwrap_2(Wrapper<T>& r, FUNC&&) ", you don't get the warning.
More information about the Gcc-bugs
mailing list