#structured-bindings
3 posts tagged #structured-bindings.
The bug got an answer in 95 minutes
A GCC report filed at 15:44 had a header-free reduction by 16:42 and a root cause by 17:19, from the person who implemented the feature. The cause is a cleanup point that exists to satisfy one core issue and ends a lifetime it should not during constant evaluation.
Getting values out of a match
Numbered captures, named captures, and structured bindings that destructure a match directly. C++26 lets the binding itself be the condition, which removes the trailing test, though one compiler currently disagrees about that inside constant expressions.
A C++26 structured binding that GCC and Clang disagree about
C++26 lets a structured binding declaration be the condition of an if. GCC 16.1 and Clang 22.1 both implement it and both agree on ordinary structs. Put a tuple-protocol type in the condition and evaluate it at compile time, and GCC rejects the program while Clang accepts it. The reproducer is twenty lines and needs no library.