http://llvm.org/bugs/show_bug.cgi?id=15461
Bug ID: 15461
Summary: Assert on invalid "Not an array type!" with alias
template which doesn't provide a deduced value
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++11
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
#include <type_traits>
#include <utility>
#include <memory>
template <class T, class ...Args>
typename std::enable_if
<
!std::is_array<T>::value,
std::unique_ptr<T>
>::type
make_unique(Args&& ...args)
{
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
template <class A, class B> using First = A;
template <class T, class ...X>
typename std::enable_if
<
std::is_array<T>::value,
std::unique_ptr<T>
>::type
make_unique(std::size_t n, First<T, X> ...inits)
{
typedef typename std::remove_extent<T>::type RT;
return std::unique_ptr<T>(new RT[n]{inits...});
}
int main()
{
auto p1 = make_unique<int>(3);
auto p2 = make_unique<int[]>(3);
}
--
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