Workaround for clang 5.0.0 on Ubuntu Trusty in Travis CI failing to compile a structural binding

clang fails with:

/home/travis/build/ethereum/solidity/libsolutil/CommonData.h:167:19: error: unused variable '' [-Werror,-Wunused-variable]
        for (auto const& [key, value]: originalMap)
This commit is contained in:
cameel 2020-01-30 02:12:54 +01:00
parent 5fbc4d4afa
commit c4f8df3272

View File

@ -164,10 +164,10 @@ template <typename K, typename V>
std::map<V, K> invertMap(std::map<K, V> const& originalMap)
{
std::map<V, K> inverseMap;
for (auto const& [key, value]: originalMap)
for (auto const& originalPair: originalMap)
{
assert(inverseMap.count(value) == 0);
inverseMap.insert({value, key});
assert(inverseMap.count(originalPair.second) == 0);
inverseMap.insert({originalPair.second, originalPair.first});
}
return inverseMap;