<div dir="ltr">This used to build and now doesn't:<div><br></div><div><div>  std::map<int, int, std::less<int>, std::allocator<std::pair<int, int>>> m;</div></div><div><br></div><div>Maybe the static assert text could say something slightly more friendly that hints at the pair's first entry having to be const? This is probably difficult to figure out unless you know this already.</div><div><br></div><div>(Real-life version: <a href="https://code.google.com/p/chromium/issues/detail?id=562227">https://code.google.com/p/chromium/issues/detail?id=562227</a>)</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 25, 2015 at 8:24 PM, Marshall Clow via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: marshall<br>
Date: Wed Nov 25 19:24:04 2015<br>
New Revision: 254119<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=254119&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=254119&view=rev</a><br>
Log:<br>
Add static_assert to set/multiset/map/multimap/forward_list/deque that the allocator's value_type match the container's value_type. vector/unordered/list/string already do this. Add tests for all the containers to verify this.<br>
<br>
Added:<br>
    libcxx/trunk/test/std/containers/associative/map/allocator_mismatch.fail.cpp<br>
    libcxx/trunk/test/std/containers/associative/multimap/allocator_mismatch.fail.cpp<br>
    libcxx/trunk/test/std/containers/associative/multiset/allocator_mismatch.fail.cpp<br>
    libcxx/trunk/test/std/containers/associative/set/allocator_mismatch.fail.cpp<br>
    libcxx/trunk/test/std/containers/sequences/deque/allocator_mismatch.fail.cpp<br>
    libcxx/trunk/test/std/containers/sequences/forwardlist/allocator_mismatch.fail.cpp<br>
    libcxx/trunk/test/std/containers/sequences/list/allocator_mismatch.fail.cpp<br>
    libcxx/trunk/test/std/containers/sequences/vector/allocator_mismatch.fail.cpp<br>
    libcxx/trunk/test/std/containers/unord/unord.map/allocator_mismatch.fail.cpp<br>
    libcxx/trunk/test/std/containers/unord/unord.multimap/allocator_mismatch.fail.cpp<br>
    libcxx/trunk/test/std/containers/unord/unord.multiset/allocator_mismatch.fail.cpp<br>
    libcxx/trunk/test/std/containers/unord/unord.set/allocator_mismatch.fail.cpp<br>
    libcxx/trunk/test/std/strings/basic.string/allocator_mismatch.fail.cpp<br>
Modified:<br>
    libcxx/trunk/include/deque<br>
    libcxx/trunk/include/forward_list<br>
    libcxx/trunk/include/map<br>
    libcxx/trunk/include/set<br>
<br>
Modified: libcxx/trunk/include/deque<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/deque?rev=254119&r1=254118&r2=254119&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/deque?rev=254119&r1=254118&r2=254119&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/deque (original)<br>
+++ libcxx/trunk/include/deque Wed Nov 25 19:24:04 2015<br>
@@ -1196,6 +1196,9 @@ public:<br>
     typedef _Tp value_type;<br>
     typedef _Allocator allocator_type;<br>
<br>
+    static_assert((is_same<typename allocator_type::value_type, value_type>::value),<br>
+                  "Allocator::value_type must be same type as value_type");<br>
+<br>
     typedef __deque_base<value_type, allocator_type> __base;<br>
<br>
     typedef typename __base::__alloc_traits        __alloc_traits;<br>
<br>
Modified: libcxx/trunk/include/forward_list<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/forward_list?rev=254119&r1=254118&r2=254119&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/forward_list?rev=254119&r1=254118&r2=254119&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/forward_list (original)<br>
+++ libcxx/trunk/include/forward_list Wed Nov 25 19:24:04 2015<br>
@@ -537,6 +537,9 @@ public:<br>
     typedef _Tp    value_type;<br>
     typedef _Alloc allocator_type;<br>
<br>
+    static_assert((is_same<typename allocator_type::value_type, value_type>::value),<br>
+                  "Allocator::value_type must be same type as value_type");<br>
+<br>
     typedef value_type&                                                reference;<br>
     typedef const value_type&                                          const_reference;<br>
     typedef typename allocator_traits<allocator_type>::pointer         pointer;<br>
<br>
Modified: libcxx/trunk/include/map<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/map?rev=254119&r1=254118&r2=254119&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/map?rev=254119&r1=254118&r2=254119&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/map (original)<br>
+++ libcxx/trunk/include/map Wed Nov 25 19:24:04 2015<br>
@@ -840,6 +840,9 @@ public:<br>
     typedef value_type&                              reference;<br>
     typedef const value_type&                        const_reference;<br>
<br>
+    static_assert((is_same<typename allocator_type::value_type, value_type>::value),<br>
+                  "Allocator::value_type must be same type as value_type");<br>
+<br>
     class _LIBCPP_TYPE_VIS_ONLY value_compare<br>
         : public binary_function<value_type, value_type, bool><br>
     {<br>
@@ -1696,6 +1699,9 @@ public:<br>
     typedef value_type&                              reference;<br>
     typedef const value_type&                        const_reference;<br>
<br>
+    static_assert((is_same<typename allocator_type::value_type, value_type>::value),<br>
+                  "Allocator::value_type must be same type as value_type");<br>
+<br>
     class _LIBCPP_TYPE_VIS_ONLY value_compare<br>
         : public binary_function<value_type, value_type, bool><br>
     {<br>
<br>
Modified: libcxx/trunk/include/set<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/set?rev=254119&r1=254118&r2=254119&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/set?rev=254119&r1=254118&r2=254119&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/set (original)<br>
+++ libcxx/trunk/include/set Wed Nov 25 19:24:04 2015<br>
@@ -409,6 +409,9 @@ public:<br>
     typedef value_type&                              reference;<br>
     typedef const value_type&                        const_reference;<br>
<br>
+    static_assert((is_same<typename allocator_type::value_type, value_type>::value),<br>
+                  "Allocator::value_type must be same type as value_type");<br>
+<br>
 private:<br>
     typedef __tree<value_type, value_compare, allocator_type> __base;<br>
     typedef allocator_traits<allocator_type>                  __alloc_traits;<br>
@@ -819,6 +822,9 @@ public:<br>
     typedef value_type&                              reference;<br>
     typedef const value_type&                        const_reference;<br>
<br>
+    static_assert((is_same<typename allocator_type::value_type, value_type>::value),<br>
+                  "Allocator::value_type must be same type as value_type");<br>
+<br>
 private:<br>
     typedef __tree<value_type, value_compare, allocator_type> __base;<br>
     typedef allocator_traits<allocator_type>                  __alloc_traits;<br>
<br>
Added: libcxx/trunk/test/std/containers/associative/map/allocator_mismatch.fail.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/allocator_mismatch.fail.cpp?rev=254119&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/allocator_mismatch.fail.cpp?rev=254119&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/containers/associative/map/allocator_mismatch.fail.cpp (added)<br>
+++ libcxx/trunk/test/std/containers/associative/map/allocator_mismatch.fail.cpp Wed Nov 25 19:24:04 2015<br>
@@ -0,0 +1,18 @@<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+// <map><br>
+//   The container's value type must be the same as the allocator's value type<br>
+<br>
+#include <map><br>
+<br>
+int main()<br>
+{<br>
+    std::map<int, int, std::less<int>, std::allocator<long> > m;<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/containers/associative/multimap/allocator_mismatch.fail.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/allocator_mismatch.fail.cpp?rev=254119&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/allocator_mismatch.fail.cpp?rev=254119&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/containers/associative/multimap/allocator_mismatch.fail.cpp (added)<br>
+++ libcxx/trunk/test/std/containers/associative/multimap/allocator_mismatch.fail.cpp Wed Nov 25 19:24:04 2015<br>
@@ -0,0 +1,18 @@<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+// <map><br>
+//   The container's value type must be the same as the allocator's value type<br>
+<br>
+#include <map><br>
+<br>
+int main()<br>
+{<br>
+    std::multimap<int, int, std::less<int>, std::allocator<long> > m;<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/containers/associative/multiset/allocator_mismatch.fail.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/allocator_mismatch.fail.cpp?rev=254119&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/allocator_mismatch.fail.cpp?rev=254119&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/containers/associative/multiset/allocator_mismatch.fail.cpp (added)<br>
+++ libcxx/trunk/test/std/containers/associative/multiset/allocator_mismatch.fail.cpp Wed Nov 25 19:24:04 2015<br>
@@ -0,0 +1,18 @@<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+// <set><br>
+//   The container's value type must be the same as the allocator's value type<br>
+<br>
+#include <set><br>
+<br>
+int main()<br>
+{<br>
+    std::multiset<int, std::less<int>, std::allocator<long> > ms;<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/containers/associative/set/allocator_mismatch.fail.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/allocator_mismatch.fail.cpp?rev=254119&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/allocator_mismatch.fail.cpp?rev=254119&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/containers/associative/set/allocator_mismatch.fail.cpp (added)<br>
+++ libcxx/trunk/test/std/containers/associative/set/allocator_mismatch.fail.cpp Wed Nov 25 19:24:04 2015<br>
@@ -0,0 +1,18 @@<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+// <set><br>
+//   The container's value type must be the same as the allocator's value type<br>
+<br>
+#include <set><br>
+<br>
+int main()<br>
+{<br>
+    std::set<int, std::less<int>, std::allocator<long> > s;<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/containers/sequences/deque/allocator_mismatch.fail.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/allocator_mismatch.fail.cpp?rev=254119&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/allocator_mismatch.fail.cpp?rev=254119&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/containers/sequences/deque/allocator_mismatch.fail.cpp (added)<br>
+++ libcxx/trunk/test/std/containers/sequences/deque/allocator_mismatch.fail.cpp Wed Nov 25 19:24:04 2015<br>
@@ -0,0 +1,18 @@<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+// <deque><br>
+//   The container's value type must be the same as the allocator's value type<br>
+<br>
+#include <deque><br>
+<br>
+int main()<br>
+{<br>
+    std::deque<int, std::allocator<long> > d;<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/containers/sequences/forwardlist/allocator_mismatch.fail.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/allocator_mismatch.fail.cpp?rev=254119&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/allocator_mismatch.fail.cpp?rev=254119&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/containers/sequences/forwardlist/allocator_mismatch.fail.cpp (added)<br>
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/allocator_mismatch.fail.cpp Wed Nov 25 19:24:04 2015<br>
@@ -0,0 +1,18 @@<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+// <forward_list><br>
+//   The container's value type must be the same as the allocator's value type<br>
+<br>
+#include <forward_list><br>
+<br>
+int main()<br>
+{<br>
+    std::forward_list<int, std::allocator<long> > fl;<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/containers/sequences/list/allocator_mismatch.fail.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/allocator_mismatch.fail.cpp?rev=254119&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/allocator_mismatch.fail.cpp?rev=254119&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/containers/sequences/list/allocator_mismatch.fail.cpp (added)<br>
+++ libcxx/trunk/test/std/containers/sequences/list/allocator_mismatch.fail.cpp Wed Nov 25 19:24:04 2015<br>
@@ -0,0 +1,18 @@<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+// <list><br>
+//   The container's value type must be the same as the allocator's value type<br>
+<br>
+#include <list><br>
+<br>
+int main()<br>
+{<br>
+    std::list<int, std::allocator<long> > l;<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/containers/sequences/vector/allocator_mismatch.fail.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector/allocator_mismatch.fail.cpp?rev=254119&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector/allocator_mismatch.fail.cpp?rev=254119&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/containers/sequences/vector/allocator_mismatch.fail.cpp (added)<br>
+++ libcxx/trunk/test/std/containers/sequences/vector/allocator_mismatch.fail.cpp Wed Nov 25 19:24:04 2015<br>
@@ -0,0 +1,18 @@<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+// <vector><br>
+//   The container's value type must be the same as the allocator's value type<br>
+<br>
+#include <vector><br>
+<br>
+int main()<br>
+{<br>
+    std::vector<int, std::allocator<long> > v;<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/containers/unord/unord.map/allocator_mismatch.fail.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.map/allocator_mismatch.fail.cpp?rev=254119&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.map/allocator_mismatch.fail.cpp?rev=254119&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/containers/unord/unord.map/allocator_mismatch.fail.cpp (added)<br>
+++ libcxx/trunk/test/std/containers/unord/unord.map/allocator_mismatch.fail.cpp Wed Nov 25 19:24:04 2015<br>
@@ -0,0 +1,18 @@<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+// <unordered_map><br>
+//   The container's value type must be the same as the allocator's value type<br>
+<br>
+#include <unordered_map><br>
+<br>
+int main()<br>
+{<br>
+    std::unordered_map<int, int, std::hash<int>, std::less<int>, std::allocator<long> > m;<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/containers/unord/unord.multimap/allocator_mismatch.fail.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multimap/allocator_mismatch.fail.cpp?rev=254119&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multimap/allocator_mismatch.fail.cpp?rev=254119&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/containers/unord/unord.multimap/allocator_mismatch.fail.cpp (added)<br>
+++ libcxx/trunk/test/std/containers/unord/unord.multimap/allocator_mismatch.fail.cpp Wed Nov 25 19:24:04 2015<br>
@@ -0,0 +1,18 @@<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+// <unordered_map><br>
+//   The container's value type must be the same as the allocator's value type<br>
+<br>
+#include <unordered_map><br>
+<br>
+int main()<br>
+{<br>
+    std::unordered_multimap<int, int, std::hash<int>, std::less<int>, std::allocator<long> > m;<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/containers/unord/unord.multiset/allocator_mismatch.fail.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multiset/allocator_mismatch.fail.cpp?rev=254119&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multiset/allocator_mismatch.fail.cpp?rev=254119&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/containers/unord/unord.multiset/allocator_mismatch.fail.cpp (added)<br>
+++ libcxx/trunk/test/std/containers/unord/unord.multiset/allocator_mismatch.fail.cpp Wed Nov 25 19:24:04 2015<br>
@@ -0,0 +1,18 @@<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+// <unordered_set><br>
+//   The container's value type must be the same as the allocator's value type<br>
+<br>
+#include <unordered_set><br>
+<br>
+int main()<br>
+{<br>
+    std::unordered_multiset<int, std::hash<int>, std::less<int>, std::allocator<long> > v;<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/containers/unord/unord.set/allocator_mismatch.fail.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.set/allocator_mismatch.fail.cpp?rev=254119&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.set/allocator_mismatch.fail.cpp?rev=254119&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/containers/unord/unord.set/allocator_mismatch.fail.cpp (added)<br>
+++ libcxx/trunk/test/std/containers/unord/unord.set/allocator_mismatch.fail.cpp Wed Nov 25 19:24:04 2015<br>
@@ -0,0 +1,18 @@<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+// <unordered_set><br>
+//   The container's value type must be the same as the allocator's value type<br>
+<br>
+#include <unordered_set><br>
+<br>
+int main()<br>
+{<br>
+    std::unordered_set<int, std::hash<int>, std::less<int>, std::allocator<long> > v;<br>
+}<br>
<br>
Added: libcxx/trunk/test/std/strings/basic.string/allocator_mismatch.fail.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/allocator_mismatch.fail.cpp?rev=254119&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/allocator_mismatch.fail.cpp?rev=254119&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/strings/basic.string/allocator_mismatch.fail.cpp (added)<br>
+++ libcxx/trunk/test/std/strings/basic.string/allocator_mismatch.fail.cpp Wed Nov 25 19:24:04 2015<br>
@@ -0,0 +1,18 @@<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+// <string><br>
+//   The container's value type must be the same as the allocator's value type<br>
+<br>
+#include <string><br>
+<br>
+int main()<br>
+{<br>
+    std::basic_string<char, std::char_traits<char>, std::allocator<int> > s;<br>
+}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>