<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 --- - ambiguous __construct_node while using tuple as a key for a map"
href="http://llvm.org/bugs/show_bug.cgi?id=16542">16542</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>ambiguous __construct_node while using tuple as a key for a map
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>hhinnant@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sandipan.mohanty@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>The following code compiles and behaves as expected using g++ as well as
clang++ with libstdc++. But clang++ with libc++ produces errors. Here is the
test code:
#include <map>
#include <tuple>
using namespace std;
int main()
{
map<tuple<int,int>, size_t> m;
m[make_tuple<int,int>(2,3)]=7;
}
The error remained the same under clang versions 3.3 (Revision: 185618) and 3.4
(Revision: 185530). Below, I quote the full error message.
--------------------------------------
In file included from maptest.cc:1:
/home/sandipan/local/llvm/3.3/include/c++/v1/map:1295:29: error: call to member
function '__construct_node' is ambiguous
__node_holder __h = __construct_node(_VSTD::move(__k));
^~~~~~~~~~~~~~~~
maptest.cc:7:6: note: in instantiation of member function
'std::__1::map<std::__1::tuple<int, int>, unsigned long,
std::__1::less<std::__1::tuple<int, int> >,
std::__1::allocator<std::__1::pair<const std::__1::tuple<int, int>,
unsigned long> > >::operator[]' requested here
m[make_tuple<int,int>(2,3)]=7;
^
/home/sandipan/local/llvm/3.3/include/c++/v1/map:994:10: note: candidate
function [with _A0 = std::__1::tuple<int, int>]
__construct_node(_A0&& __a0);
^
/home/sandipan/local/llvm/3.3/include/c++/v1/map:1001:10: note: candidate
function [with _A0 = std::__1::tuple<int, int>]
__construct_node(_A0&& __a0);
^
/home/sandipan/local/llvm/3.3/include/c++/v1/map:1004:23: note: candidate
function template not viable: requires at least 2 arguments, but 1 was provided
__node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&&
...__args);
^
/home/sandipan/local/llvm/3.3/include/c++/v1/map:987:19: note: candidate
function not viable: requires 0 arguments, but 1 was provided
__node_holder __construct_node();
^
1 error generated.
--------------------------
I haven't examined the code very carefully, but it seems there are two
declarations as well as definitions of a function with the (effective)
signature:
__node_holder __construct_node(_A0 &&);</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>