<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 --- - is_constructible<int (int)> should be false"
href="https://llvm.org/bugs/show_bug.cgi?id=25513">25513</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>is_constructible<int (int)> should be false
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sfinae@hotmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=15283" name="attach_15283" title="self contained repro">attachment 15283</a> <a href="attachment.cgi?id=15283&action=edit" title="self contained repro">[details]</a></span>
self contained repro
Function types shouldn't be considered constructible (unless I am completely
confused).
C:\Temp>type meow.cpp
template <typename T, typename... Args> struct is_constructible {
static constexpr bool value = __is_constructible(T, Args...);
};
template <typename T, typename... Args> struct is_nothrow_constructible {
static constexpr bool value = __is_nothrow_constructible(T, Args...);
};
template <typename T, typename... Args> struct is_trivially_constructible {
static constexpr bool value = __is_trivially_constructible(T, Args...);
};
static_assert(! is_constructible<int (int)>::value, "BOOM");
static_assert(! is_nothrow_constructible<int (int)>::value, "BOOM");
static_assert(!is_trivially_constructible<int (int)>::value, "BOOM");
/***
N4527 20.10.4.3 [meta.unary.prop]/7:
Given the following function declaration:
template <class T>
add_rvalue_reference_t<T> create() noexcept;
the predicate condition for a template specialization is_constructible<T,
Args...>
shall be satisfied if and only if the following variable definition would be
well-formed for some invented variable t:
T t(create<Args>()...);
[ Note: These tokens are never interpreted as a function declaration. -end note
]
Access checking is performed as if in a context unrelated to T and any of the
Args.
Only the validity of the immediate context of the variable initialization is
considered.
[ Note: The evaluation of the initialization can result in side effects such as
the
instantiation of class template specializations and function template
specializations,
the generation of implicitly-defined functions, and so on. Such side effects
are not
in the "immediate context" and can result in the program being ill-formed. -end
note ]
***/
C1XX accepts:
C:\Temp>cl /EHsc /nologo /W4 /c meow.cpp
meow.cpp
But Clang/C2 rejects:
C:\Temp>clang-cl /EHsc /nologo /W4 /c meow.cpp
meow.cpp(13,1) : error: static_assert failed "BOOM"
static_assert(! is_constructible<int (int)>::value, "BOOM");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
meow.cpp(14,1) : error: static_assert failed "BOOM"
static_assert(! is_nothrow_constructible<int (int)>::value, "BOOM");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
meow.cpp(15,1) : error: static_assert failed "BOOM"
static_assert(!is_trivially_constructible<int (int)>::value, "BOOM");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 errors generated.
This is NOT specific to Clang/C2 - <a href="http://melpon.org/wandbox/">http://melpon.org/wandbox/</a> also rejects. The
same thing happens if libc++ <type_traits> is used instead of the compiler
hooks used above.</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>