Fix http://llvm.org/bugs/show_bug.cgi?id=11461.  Credit Alberto Ganesh Barbati.

llvm-svn: 146345
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 42b8bb503308b79214c44a233a1586146802aa28
diff --git a/include/memory b/include/memory
index c3e3af4..e7fe78e 100644
--- a/include/memory
+++ b/include/memory
@@ -1848,8 +1848,16 @@
 
 template <class _T1, class _T2, bool = is_same<typename remove_cv<_T1>::type,
                                                      typename remove_cv<_T2>::type>::value,
-                                bool = is_empty<_T1>::value,
-                                bool = is_empty<_T2>::value>
+                                bool = is_empty<_T1>::value
+#if __has_feature(is_final)
+                                       && !__is_final(_T1)
+#endif
+                                ,
+                                bool = is_empty<_T2>::value
+#if __has_feature(is_final)
+                                       && !__is_final(_T2)
+#endif
+         >
 struct __libcpp_compressed_pair_switch;
 
 template <class _T1, class _T2, bool IsSame>