[LLVMbugs] [Bug 16542] New: ambiguous __construct_node while using tuple as a key for a map

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 4 10:53:01 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16542

            Bug ID: 16542
           Summary: ambiguous __construct_node while using tuple as a key
                    for a map
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: hhinnant at apple.com
          Reporter: sandipan.mohanty at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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 &&);

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130704/82c6b2f2/attachment.html>


More information about the llvm-bugs mailing list