From ea51f976f29a016063ef58735a6515e77586cc63 Mon Sep 17 00:00:00 2001
From: John Preston <johnprestonmail@gmail.com>
Date: Fri, 29 Dec 2017 21:47:49 +0300
Subject: [PATCH] Alpha version 1.2.5: Workaround GCC 7.2 ICE.

---
 .../SourceFiles/media/view/media_view_group_thumbs.cpp   | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Telegram/SourceFiles/media/view/media_view_group_thumbs.cpp b/Telegram/SourceFiles/media/view/media_view_group_thumbs.cpp
index 8a09de0f3..b5203ad32 100644
--- a/Telegram/SourceFiles/media/view/media_view_group_thumbs.cpp
+++ b/Telegram/SourceFiles/media/view/media_view_group_thumbs.cpp
@@ -443,7 +443,8 @@ void GroupThumbs::fillDyingItems(const std::vector<not_null<Thumb*>> &old) {
 
 void GroupThumbs::markRestAsDying() {
 	_dying.reserve(_cache.size() - _items.size());
-	for (const auto &[key, thumb] : _cache) {
+	for (const auto &cacheItem : _cache) {
+		const auto &thumb = cacheItem.second;
 		const auto state = thumb->state();
 		if (state == Thumb::State::Unknown) {
 			markAsDying(thumb.get());
@@ -518,7 +519,8 @@ void GroupThumbs::markCacheStale() {
 	while (!_dying.empty()) {
 		_dying.pop_back();
 	}
-	for (const auto &[key, thumb] : _cache) {
+	for (const auto &cacheItem : _cache) {
+		const auto &thumb = cacheItem.second;
 		thumb->setState(Thumb::State::Unknown);
 	}
 }
@@ -617,7 +619,8 @@ void GroupThumbs::paint(
 
 ClickHandlerPtr GroupThumbs::getState(QPoint point) const {
 	point -= QPoint((_width / 2), st::mediaviewGroupPadding.top());
-	for (const auto &[key, thumb] : _cache) {
+	for (const auto &cacheItem : _cache) {
+		const auto &thumb = cacheItem.second;
 		if (auto link = thumb->getState(point)) {
 			return link;
 		}