[Bug c++/114225] False positive -Werror=dangling-reference
fchelnokov at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Mar 4 09:53:17 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114225
--- Comment #4 from Fedor Chelnokov <fchelnokov at gmail dot com> ---
Ok.
At the same time we see that some false positives of this warning are fixed in
Trunk, e.g.
struct A {
int i;
};
struct Getter {
const A * a;
const int & value() const { return a->i; }
};
int main() {
A a { .i = 1 };
const auto & i = Getter{ &a }.value();
return i;
}
Online demo: https://godbolt.org/z/z9rPx831n
So we assume that this one can be fixed as well, why not?
More information about the Gcc-bugs
mailing list