http://llvm.org/bugs/show_bug.cgi?id=15634
Bug ID: 15634
Summary: Diagnostic for failed template deduction is
insufficient
Product: clang
Version: 3.2
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
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 http://liveworkspace.org/code/2uLY7q$4)
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.
--
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