<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - static_assert's in the stl containers break SFINAE"
href="https://llvm.org/bugs/show_bug.cgi?id=23014">23014</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>static_assert's in the stl containers break SFINAE
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>3.5
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>tyler.m.kopf@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu, mclow.lists@gmail.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>There's a static_assert in all of the STL containers verifying that:
std::allocator<int>::value_type == value_type
They appear to have been added in attempt to fix this bug report:
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - vector<T1, allocator<T2>> fails to compile"
href="show_bug.cgi?id=15576">https://llvm.org/bugs/show_bug.cgi?id=15576</a>
This means one cannot attempt to use SFINAE with such invalid types, as in the
following example code:
template<typename T, typename U, typename = void>
struct attempt_rebind {
using type = T;
};
template<template<typename...> class Container, typename T, typename U,
typename... OtherArgs>
struct attempt_rebind<
Container<T, OtherArgs...>,
U,
std::enable_if_t<
std::is_constructible<
Container<T, OtherArgs...>,
Container<U, OtherArgs...>
>::value
>
>
{
using type = Container<U, OtherArgs...>;
};
static_assert(
std::is_same<
std::vector<int, std::allocator<int>>,
typename attempt_rebind<std::vector<int>, double>::type
>::value,
"This should pass!"
);
Compilation of this valid code is blocked by the static_assert in std::vector.
Thank you!</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>