On 10/27/22 11:39, Marek Polacek wrote:
I got this testcase:
auto f() -> std::optional;
for (char c : f().value()) { }
which has a dangling reference: std::optional::value returns
a reference to the contained value, but here it's the f() temporary.
We warn, which is great, but only with -
I got this testcase:
auto f() -> std::optional;
for (char c : f().value()) { }
which has a dangling reference: std::optional::value returns
a reference to the contained value, but here it's the f() temporary.
We warn, which is great, but only with -Wsystem-headers, because
the function comes