https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91493
Bug ID: 91493 Summary: g++ 9.2.1 crashes compiling clickhouse Product: gcc Version: 9.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rafaeldtinoco at ubuntu dot com Target Milestone: --- The following function: std::string toString(const ColumnDefaultKind kind) { static const std::unordered_map<ColumnDefaultKind, std::string> map{ { ColumnDefaultKind::Default, AliasNames::DEFAULT }, { ColumnDefaultKind::Materialized, AliasNames::MATERIALIZED }, { ColumnDefaultKind::Alias, AliasNames::ALIAS } }; const auto it = map.find(kind); return it != std::end(map) ? it->second : throw Exception{"Invalid ColumnDefaultKind", ErrorCodes::LOGICAL_ERROR}; } causes gcc9 (with attached dump) to crash while other similar function (in related syntax): ColumnDefaultKind columnDefaultKindFromString(const std::string & str) { static const std::unordered_map<std::string, ColumnDefaultKind> map{ { AliasNames::DEFAULT, ColumnDefaultKind::Default }, { AliasNames::MATERIALIZED, ColumnDefaultKind::Materialized }, { AliasNames::ALIAS, ColumnDefaultKind::Alias } }; const auto it = map.find(str); return it != std::end(map) ? it->second : throw Exception{"Unknown column default specifier: " + str, ErrorCodes::LOGICAL_ERROR}; } does not. Changing the syntax to: std::string toString(const ColumnDefaultKind kind) { static const std::unordered_map<ColumnDefaultKind, std::string> map{ { ColumnDefaultKind::Default, AliasNames::DEFAULT }, { ColumnDefaultKind::Materialized, AliasNames::MATERIALIZED }, { ColumnDefaultKind::Alias, AliasNames::ALIAS } }; const auto it = map.find(kind); if (it != std::end(map)) throw Exception{"Invalid ColumnDefaultKind", ErrorCodes::LOGICAL_ERROR}; return it->second; } fixes the issue.