<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 --- - conversion from 'void ()' to 'const Option<void (*)()>' is ambiguous" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24092&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=OjONxZVI-LYnvX3tmswIf2VQ4vw4ppeLjRfAgrMvQ88&s=Sk1SoNo6f4YqPC-yEd9PgYQ0MF7Qd2m7LE1yJshnPHY&e=">24092</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>conversion from 'void ()' to 'const Option<void (*)()>' is ambiguous
</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>MacOS X
</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>haosdent@gmail.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>This code snippet could not compile with clang++3.5, but could compile with
clang++3.6 . And I search <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=OjONxZVI-LYnvX3tmswIf2VQ4vw4ppeLjRfAgrMvQ88&s=jjD8KcCAVQFZMG6N62z7QOBfmU-kVoYtzH2XgChn7gs&e=">https://llvm.org/bugs/</a> , seems could not find any
bugs about this. So why this code snippet could not compile in clang++3.5? g++
don't have this problem. Thank you in advance.
void F() {}
template <typename T>
class Option {
public:
Option(const T &) {}
Option(T &&) {}
template <typename U>
Option(const U &) {}
};
class Fork {
public:
Fork(const Option<void (*)(void)>&) {}
};
int main() {
Fork fork(F);
}
The compile error with clang++3.5
test.cpp:25:13: error: conversion from 'void ()' to 'const Option<void (*)()>'
is ambiguous
Fork fork(F);
^
test.cpp:7:3: note: candidate constructor
Option(const T &) {}
^
test.cpp:9:3: note: candidate constructor
Option(T &&) {}
^
test.cpp:12:3: note: candidate constructor [with U = void ()]
Option(const U &) {}
^
1 error generated.
My clang++ version
clang++ --version
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix</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>