<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 --- - Diagnostic for failed template deduction is insufficient"
href="http://llvm.org/bugs/show_bug.cgi?id=15634">15634</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Diagnostic for failed template deduction is insufficient
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.2
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>berkus@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Using this sample code
[code]
#include <vector>
#include <boost/array.hpp>
class byte_array
{
std::vector<char> value;
public:
template <typename T, size_t N>
byte_array(const std::array<T, N>& in) : value(in.begin(), in.begin() + N)
{}
};
int main()
{
boost::array<unsigned char, 32> arr;
byte_array data(arr);
}
[/code]
(see <a href="http://liveworkspace.org/code/2uLY7q$4">http://liveworkspace.org/code/2uLY7q$4</a>)
Clang's error diagnostic is quite not sufficient to spot and fix the error:
[irrelevant text skipped]
source.cpp:9:5: note: candidate template ignored: failed template argument
deduction
byte_array(const std::array<T, N>& in) : value(in.begin(), in.begin() + N)
{}
^
1 error generated.
Gcc 4.8.0 on the other hand provides much more helpful text, which lets fix the
error on the spot (even gcc 4.7.2 nails it):
source.cpp:9:5: note: template argument deduction/substitution failed:
source.cpp:15:23: note: 'boost::array<unsigned char, 32ul>' is not derived
from 'const std::array<_Tp, _Nm>'
byte_array data(arr);
^
It is possible to test the output of both the compilers with provided test code
on the liveworkspace website directly.</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>