https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118020
Bug ID: 118020
Summary: SIGSEGV in std::generator<int&&>
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: hewillk at gmail dot com
Target Milestone: ---
The following gives: Program terminated with signal: SIGSEGV, not sure what
happens, so let me assume for now that this is a bug (either in the language or
in the library).
#include <generator>
std::generator<int&&> g() {
const int arr[] = {42};
for (auto& elem : arr) co_yield elem;
}
int main() {
for (auto&& i : g()) { }
}
https://godbolt.org/z/Y9zqsxY13