[BUG] Compile error: 'invalid use of ‘auto’'
Author: AJChapmanCreated Sep 18, 2026Updated Sep 18, 2026
Labelsbug
Version of Kakoune
f16dba30002c4a18a247968ad4d12043cce018a8
Reproducer
Check out commit f16dba30002c4a18a247968ad4d12043cce018a8 'Refactor mapping lookup code', the latest commit as of writing. Run make with this c++ version: c++ (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0
Outcome
λ ~/src/kakoune/ master make
c++ -std=c++2b -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-sign-compare -O3 -g3 -Wno-init-list-lifetime -Wno-stringop-overflow -MD -MP -MF src/.commands.opt.d -c -o src/commands.opt.o src/commands.cc
src/commands.cc: In lambda function:
src/commands.cc:2696:30: error: invalid use of ‘auto’
2696 | for (auto& key : auto(mapping->keys)) // copy to allow reentrant unmap
| ^~~~~~~~~~~~~~~~~~~
make: *** [Makefile:117: src/commands.opt.o] Error 1Expectations
It should compile without errors.
Additional information
Compiling on Ubuntu 22.04 "jammy".
Reverting the latest commit fixes the error.
Source: mawww/kakoune