google / benchmark

A microbenchmark support library
Apache License 2.0
8.59k stars 1.57k forks source link

[BUG] Compilation failed for using operator [] for unordered_map #1808

Open apachaihop opened 2 days ago

apachaihop commented 2 days ago

Describe the bug Compilation failed for using operator [] for unordered_map with clang 17 + stdlibc++ 14

System Which OS, compiler, and compiler version are you using:

To reproduce Steps to reproduce the behavior: https://godbolt.org/z/1sz1hdEsh

Expected behavior Inserting element at unordered_map without CE

Additional context https://github.com/google/benchmark/blob/c2146397ac69e6589a50f6b4fc6a7355669caed5/include/benchmark/benchmark.h#L864C2-L868C4 change here and https://github.com/google/benchmark/blob/c2146397ac69e6589a50f6b4fc6a7355669caed5/include/benchmark/benchmark.h#L896C3-L900C4 here to insert method with std::make_pair to better cross compilation possibilities and fixing CE

LebedevRI commented 2 days ago

Seems to work with clang-18? Looks like a pretty typical "version mismatch" pains of too new libstdc++ vs clang. It's quite unfortunate, but i doubt it's benchmark-specific.