https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109442
--- Comment #34 from Antony Polukhin <antoshkka at gmail dot com> ---
The memory allocation is still not elided for a sample from duplicate ticket
116651:
bool test1(const std::vector<int>& in) {
return in == std::vector<int>{42};
}
My naiive expectation is that the `test1` function would be optimized to an
equivalent of:
bool test2(const std::vector<int>& in) {
return in.size() == 1 && in[0] == 42;
}
Godbolt playground https://godbolt.org/z/sn5Gzq1P6