From 710b9bf4545e73a535c3a1a246b11ee2929652d0 Mon Sep 17 00:00:00 2001
From: John Preston <johnprestonmail@gmail.com>
Date: Thu, 10 May 2018 11:13:13 +0300
Subject: [PATCH] Fix build for MSVC 15.7.

Fixes #4661. Fixes #4667.
---
 Telegram/SourceFiles/rpl/event_stream.h | 4 ++++
 Telegram/SourceFiles/stdafx.h           | 9 +++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Telegram/SourceFiles/rpl/event_stream.h b/Telegram/SourceFiles/rpl/event_stream.h
index b353218b9..e0f1aeb9f 100644
--- a/Telegram/SourceFiles/rpl/event_stream.h
+++ b/Telegram/SourceFiles/rpl/event_stream.h
@@ -34,7 +34,11 @@ public:
 	void fire_copy(const Value &value) const {
 		return fire_forward(value);
 	}
+#if defined _MSC_VER && _MSC_VER >= 1914
+	producer<Value> events() const {
+#else // _MSC_VER >= 1914
 	auto events() const {
+#endif // _MSC_VER >= 1914
 		return make_producer<Value>([weak = make_weak()](
 				const auto &consumer) {
 			if (auto strong = weak.lock()) {
diff --git a/Telegram/SourceFiles/stdafx.h b/Telegram/SourceFiles/stdafx.h
index 542a08d07..ff0690ce3 100644
--- a/Telegram/SourceFiles/stdafx.h
+++ b/Telegram/SourceFiles/stdafx.h
@@ -24,13 +24,18 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
 #ifdef __clang__
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wreturn-stack-address"
-#endif // __clang__
+#elif defined _MSC_VER && _MSC_VER >= 1914 // __clang__
+#pragma warning(push)
+#pragma warning(disable:4180)
+#endif // __clang__ || _MSC_VER >= 1914
 
 #include <QtCore/QtCore>
 
 #ifdef __clang__
 #pragma clang diagnostic pop
-#endif // __clang__
+#elif defined _MSC_VER && _MSC_VER >= 1914 // __clang__
+#pragma warning(pop)
+#endif // __clang__ || _MSC_VER >= 1914
 
 #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
 #define OS_MAC_OLD