diff --git a/Telegram/SourceFiles/boxes/send_files_box.cpp b/Telegram/SourceFiles/boxes/send_files_box.cpp
index 9905b68f9..b9fcc8a98 100644
--- a/Telegram/SourceFiles/boxes/send_files_box.cpp
+++ b/Telegram/SourceFiles/boxes/send_files_box.cpp
@@ -576,7 +576,8 @@ void EditCaptionBox::prepareGifPreview(DocumentData *document) {
 	auto createGifPreview = [document] {
 		return (document && document->isAnimation());
 	};
-	if (createGifPreview()) {
+	auto createGifPreviewResult = createGifPreview(); // Clang freeze workaround.
+	if (createGifPreviewResult) {
 		_gifPreview = Media::Clip::MakeReader(document->location(), document->data(), [this](Media::Clip::Notification notification) {
 			clipCallback(notification);
 		});
diff --git a/Telegram/SourceFiles/core/basic_types.h b/Telegram/SourceFiles/core/basic_types.h
index c759a37b8..850ca6c3c 100644
--- a/Telegram/SourceFiles/core/basic_types.h
+++ b/Telegram/SourceFiles/core/basic_types.h
@@ -27,6 +27,9 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
 
 #include "core/build_config.h"
 
+// Custom libc++ build used for old OS X versions already has this.
+#ifndef OS_MAC_OLD
+
 #if defined COMPILER_CLANG || defined COMPILER_GCC
 namespace std {
 
@@ -41,6 +44,8 @@ void as_const(const T&&) = delete;
 } // namespace std
 #endif // COMPILER_CLANG || COMPILER_GCC
 
+#endif // OS_MAC_OLD
+
 #include "core/ordered_set.h"
 
 //using uchar = unsigned char; // Qt has uchar
diff --git a/Telegram/SourceFiles/stickers/emoji_pan.cpp b/Telegram/SourceFiles/stickers/emoji_pan.cpp
index 0a2dde30c..e85fc1537 100644
--- a/Telegram/SourceFiles/stickers/emoji_pan.cpp
+++ b/Telegram/SourceFiles/stickers/emoji_pan.cpp
@@ -1653,7 +1653,8 @@ int StickerPanInner::refreshInlineRows(UserData *bot, const InlineCacheEntry *en
 		}
 		return false;
 	};
-	if (clearResults()) {
+	auto clearResultsResult = clearResults(); // Clang segfault workaround.
+	if (clearResultsResult) {
 		if (resultsDeleted) {
 			clearInlineRows(true);
 			deleteUnusedInlineLayouts();