C++ Insights has received an updated lambda transformation that better reflects how the C++ standard specifies direct-initialization of captured variables. The old approach used a constructor to initialize captured data members, which caused move-only objects to be moved twice — once in the constructor parameter and once in the initializer list — producing code worse than what a real compiler generates. The new transformation uses aggregate initialization with public data members (with 'private' left as a comment) to accurately represent direct-init semantics, inspired by how GCC handles this internally. The change removed over 500 lines of code, simplified special-case handling, and produces shorter, more accurate output.
443 Impressions