https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116095
--- Comment #1 from Enrico Maria De Angelis <enricomaria.dean6elis at gmail dot com> --- Forgot to say that at the question on stackoverflow I've listed other ways that make the code compile: - change list to vector - make r const