<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 --- - map<K,V>::insert(make_pair(K(), V())) is ambiguous if K has a template constructor"
   href="http://llvm.org/bugs/show_bug.cgi?id=16549">16549</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>map<K,V>::insert(make_pair(K(), V())) is ambiguous if K has a template constructor
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>release blocker
          </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>likan_999.student@sina.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>Note: this is similar to the issue <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - map<K,V>::find(K()) is ambiguous if K has a template constructor"
   href="show_bug.cgi?id=16538">http://llvm.org/bugs/show_bug.cgi?id=16538</a>,
but even after the fix r185665, the following code still fails.
Note: g++ 4.8.1 can compile it successfully.
Note: clang++ with libstdc++ can compile it successfully.
Note: the libc++ is at trunk version.

[hidden ~]$ cat b.cpp
#include <map>
#include <utility>

struct Key {
  template <typename T> Key(const T&) {}
  bool operator< (const Key&) const { return false; }
};
auto result = std::map<Key, int>().insert(std::make_pair(Key(0), 0));

[hidden ~]$ g++ -std=c++11 -c b.cpp
[hidden ~]$ clang++ -std=c++11 -c b.cpp
[hidden ~]$ clang++ -std=c++11 -stdlib=libc++ -c b.cpp
In file included from b.cpp:1:
In file included from /usr/include/c++/v1/map:371:
/usr/include/c++/v1/__tree:1604:17: error: call to object of type
'value_compare' (aka 'std::__1::__map_value_compare<Key, int,
std::__1::less<Key>, true>') is ambiguous
            if (value_comp()(__v, __nd->__value_))
                ^~~~~~~~~~~~
/usr/include/c++/v1/__tree:1914:36: note: in instantiation of function template
specialization 'std::__1::__tree<std::__1::map<Key, int, std::__1::less<Key>,
      std::__1::allocator<std::__1::pair<const Key, int> > >::__value_type,
std::__1::__map_value_compare<Key, int, std::__1::less<Key>, true>,
      std::__1::allocator<std::__1::map<Key, int, std::__1::less<Key>,
std::__1::allocator<std::__1::pair<const Key, int> > >::__value_type>
      >::__find_equal<std::__1::map<Key, int, std::__1::less<Key>,
std::__1::allocator<std::__1::pair<const Key, int> > >::__value_type>'
requested here
    __node_base_pointer& __child = __find_equal(__parent, __nd->__value_);
                                   ^
/usr/include/c++/v1/__tree:1796:32: note: in instantiation of member function
'std::__1::__tree<std::__1::map<Key, int, std::__1::less<Key>,
      std::__1::allocator<std::__1::pair<const Key, int> > >::__value_type,
std::__1::__map_value_compare<Key, int, std::__1::less<Key>, true>,
      std::__1::allocator<std::__1::map<Key, int, std::__1::less<Key>,
std::__1::allocator<std::__1::pair<const Key, int> > >::__value_type>
<span class="quote">>::__node_insert_unique'</span >
      requested here
    pair<iterator, bool> __r = __node_insert_unique(__h.get());
                               ^
/usr/include/c++/v1/map:916:29: note: in instantiation of function template
specialization 'std::__1::__tree<std::__1::map<Key, int, std::__1::less<Key>,
      std::__1::allocator<std::__1::pair<const Key, int> > >::__value_type,
std::__1::__map_value_compare<Key, int, std::__1::less<Key>, true>,
      std::__1::allocator<std::__1::map<Key, int, std::__1::less<Key>,
std::__1::allocator<std::__1::pair<const Key, int> > >::__value_type>
      >::__insert_unique<std::__1::pair<Key, int> >' requested here
            {return __tree_.__insert_unique(_VSTD::forward<_Pp>(__p));}
                            ^
b.cpp:8:36: note: in instantiation of function template specialization
'std::__1::map<Key, int, std::__1::less<Key>,
std::__1::allocator<std::__1::pair<const Key, int> >
      >::insert<std::__1::pair<Key, int>, void>' requested here
auto result = std::map<Key, int>().insert(std::make_pair(Key(0), 0));
                                   ^
/usr/include/c++/v1/map:405:10: note: candidate function
    bool operator()(const _CP& __x, const _CP& __y) const
         ^
/usr/include/c++/v1/map:408:10: note: candidate function
    bool operator()(const _CP& __x, const _Key& __y) const
         ^
/usr/include/c++/v1/map:411:10: note: candidate function
    bool operator()(const _Key& __x, const _CP& __y) const
         ^
1 error generated.</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>