https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94575
--- Comment #2 from Joel Yliluoma <bisqwit at iki dot fi> --- Sorry, the error Marek Polacek mentions is due to a copypaste mistake on my part. The correct code that demonstrates the problem is here. The difference is the && instead of &. #include <cstdio> template<typename T> static void Use(T&& plot) { plot(1); } int main() { static const int table[1] = {123456}; Use([&](auto x) { unsigned var = table[x]; unsigned ui = var; std::printf("%u\n", ui); }); }