https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120432
Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2025-05-27 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> --- Confirmed, that fix looks good to me. FWIW our template operator[] is just the standard https://eel.is/c++draft/flat.map#access-4 with more generalized constraints: same_as<remove_cvref_t<_Key2>, _Key> || __transparent_comparator<_Compare> The intent is to be able to dispatch the non-template overloads to this template and avoid having to introduce an actual helper function. > static_assert(!C<std::flat_map<int, int>, volatile int>); // bogus error We can fix this by changing remove_cvref_t<K> to remove_const_t<remove_reference_t<K>> in the constraint, but I don't see why we'd want to reject this volatile index case?