<html>
<head>
<base href="http://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 --- - Overload is incorrectly ignored"
href="http://llvm.org/bugs/show_bug.cgi?id=21481">21481</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Overload is incorrectly ignored
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.5
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>graeser@mi.fu-berlin.de
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=13290" name="attach_13290" title="Test case failing with clang-3.5. Compile with -std=c++11">attachment 13290</a> <a href="attachment.cgi?id=13290&action=edit" title="Test case failing with clang-3.5. Compile with -std=c++11">[details]</a></span>
Test case failing with clang-3.5. Compile with -std=c++11
Under certain conditions clang ignores a function overload due to a
substitution failure although substitution should succeed. Suppose you have
template<class... T>
struct Foo
{};
template<class T0, class... T>
struct Foo<T0, T...>
{
typedef T0 First;
};
and two overloaded functions selected using enable_if
template<class C, class... T,
typename std::enable_if<std::is_same<C, Foo<> >::value, int>::type =0>
int bar()
{
return 0;
}
template<class C, class... T,
typename std::enable_if<!(std::is_same<C, Foo<> >::value), int>::type =0>
auto bar()
-> decltype(typename C::First()) // This should be OK by SFINAE
{
return 0;
}
Then substitution of C::First should work for C=Foo<int>. However clang rejects
bar<Foo<int>, char>(). Surprisingly the overload is used if the additional char
parameter is omitted or if an instance of Foo<int> is created in main().
A test case that fails with clang-3.5 is attached. Notice that the variadic
templates seem to be necessary to trigger the problem.
Side note: gcc-4.8 accepts the code.</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>