<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 --- - When printing an ambiguous-overload error that causes a substitution failure, print the candidates"
href="http://llvm.org/bugs/show_bug.cgi?id=22192">22192</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>When printing an ambiguous-overload error that causes a substitution failure, print the candidates
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.5
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>zeratul976@hotmail.com
</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>Consider the following (invalid) code:
void foo(double);
void foo(long);
template <typename T>
decltype(foo(T())) bar(T);
int main()
{
bar(3);
}
The error message clang prints for this is:
test.cpp:9:5: error: no matching function for call to 'bar'
bar(3);
^~~
test.cpp:5:20: note: candidate template ignored: substitution failure [with
T = int]: call to 'foo' is ambiguous
decltype(foo(T())) bar(T);
~~~ ^
The error message talks about an overload ambiguity, but doesn't print the
candidates.
Compare the error given by gcc:
test.cpp: In function 'int main()':
test.cpp:9:10: error: no matching function for call to 'bar(int)'
bar(3);
^
test.cpp:9:10: note: candidate is:
test.cpp:5:20: note: template<class T> decltype (foo(T())) bar(T)
decltype(foo(T())) bar(T);
^
test.cpp:5:20: note: template argument deduction/substitution failed:
test.cpp: In substitution of 'template<class T> decltype (foo(T())) bar(T)
[with T = int]':
test.cpp:9:10: required from here
test.cpp:5:17: error: call of overloaded 'foo(int)' is ambiguous
decltype(foo(T())) bar(T);
^
test.cpp:5:17: note: candidates are:
test.cpp:1:6: note: void foo(double)
void foo(double);
^
test.cpp:2:6: note: void foo(long int)
void foo(long);
^
which lists the candidates.
I think it's important to list the candidates, so the user can understand the
error and fix the ambiguity more efficiently.</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>