-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gcc13.1 warning: possibly dangling reference to a temporary w/ostream operator #3415
Comments
Also happens when a specialisation of fmt::formatter is added, e.g https://godbolt.org/z/r657Yhc9Y
|
This is clearly a false positive because Lines 1453 to 1462 in 192df93
Lines 1444 to 1447 in 192df93
which passes the reference through without any temporaries involved. f61f15c implements a workaround but please report a bug to gcc. |
GCC will temporarily move the warning to -Wextra Currently it's producing many false positives. |
Thanks for the link! |
Thanks everyone! |
gcc 13.1 erroneously warns of dangling references when using our custom formatters. This was reported to both fmtlib and gcc and fixes have been provided, but are not released yet. This change backports two fixes from the master branch to our vendored version: fmtlib/fmt@f61f15c fmtlib/fmt@ef55d4f For more information on the issue, see: fmtlib/fmt#3415 https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=6b927b1297e66e26e62e722bf15c921dcbbd25b9 Signed-off-by: Jérémie Galarneau <[email protected]> Change-Id: I30bbbbe5e0aa2729e50228acdb528ee060d9df23
…m fmtlib trunk /builds/cado-nfs/cado-nfs/utils/badideals.cpp:164:27: required from here /builds/cado-nfs/cado-nfs/utils/embedded/fmt/core.h:1735:15: error: possibly dangling reference to a temporary [-Werror=dangling-reference] 1735 | const auto& arg = arg_mapper<Context>().map(FMT_FORWARD(val)); | ^~~ /builds/cado-nfs/cado-nfs/utils/embedded/fmt/core.h:1735:46: note: the temporary was destroyed at the end of the full expression 'fmt::v9::detail::arg_mapper<fmt::v9::basic_format_context<fmt::v9::appender, char> >().fmt::v9::detail::arg_mapper<fmt::v9::basic_format_context<fmt::v9::appender, char> >::map<cxx_mpz&>((* & val))' 1735 | const auto& arg = arg_mapper<Context>().map(FMT_FORWARD(val)); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ This is the same as fmtlib/fmt#3415
* See fmtlib/fmt#3415 Signed-off-by: Shen-Ta Hsieh <[email protected]>
* See fmtlib/fmt#3415 Signed-off-by: Shen-Ta Hsieh <[email protected]>
* See fmtlib/fmt#3415 Signed-off-by: Shen-Ta Hsieh <[email protected]>
* See fmtlib/fmt#3415 Signed-off-by: Shen-Ta Hsieh <[email protected]>
* See fmtlib/fmt#3415 Signed-off-by: Shen-Ta Hsieh <[email protected]>
Hi. Using current to of tree (02cae7e), I see this warning with aarch64 gcc 13.1 -Wall. On godbolt, I used "arm64 gcc trunk" to compile and got this error (They don't have an arm64 gcc 13.1 listed yet). Oddly, I don't see the error with x86-64 gcc13.1. No error with gcc 11.3 or 12.2 on aarch64.
Here is a godbolt repro link:
https://godbolt.org/z/ajsGKe4nE
The text was updated successfully, but these errors were encountered: