https://llvm.org/bugs/show_bug.cgi?id=23014
Bug ID: 23014
Summary: static_assert's in the stl containers break SFINAE
Product: libc++
Version: 3.5
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
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:
https://llvm.org/bugs/show_bug.cgi?id=15576
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!
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs