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

        <tr>
          <th>Summary</th>
          <td>map<K,V>::find(K()) 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 not the same issue as <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - std::map<S,T>::erase(iterator) is ambiguous if S has a template constructor"
   href="show_bug.cgi?id=12027">http://llvm.org/bugs/show_bug.cgi?id=12027</a>.
Note: g++ 4.8.1 can compile it successfully.
Note: the libc++ is at trunk version.


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

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

[hidden ~]$ g++ -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:2020:26: error: call to object of type
'value_compare' (aka 'std::__1::__map_value_compare<Key, int,
std::__1::less<Key>, true>') is ambiguous
    if (__p != end() && !value_comp()(__v, *__p))
                         ^~~~~~~~~~~~
/usr/include/c++/v1/map:1006:68: 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>
<span class="quote">>::find<Key>' requested here</span >
    iterator find(const key_type& __k)             {return __tree_.find(__k);}
                                                                   ^
b.cpp:7:32: note: in instantiation of member function 'std::__1::map<Key, int,
std::__1::less<Key>, std::__1::allocator<std::__1::pair<const Key, int> >
<span class="quote">>::find'</span >
      requested here
auto it = std::map<Key, int>().find(Key(0));
                               ^
/usr/include/c++/v1/map:424:10: note: candidate function
    bool operator()(const _Key& __x, const _CP& __y) const
         ^
/usr/include/c++/v1/map:430:10: note: candidate function
    bool operator()(const _Key& __x, const _Key& __y) const
         ^
In file included from b.cpp:1:
In file included from /usr/include/c++/v1/map:371:
/usr/include/c++/v1/__tree:2093:14: 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()(__root->__value_, __v))
             ^~~~~~~~~~~~
/usr/include/c++/v1/__tree:2019:20: 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>
<span class="quote">>::__lower_bound<Key>'</span >
      requested here
    iterator __p = __lower_bound(__v, __root(), __end_node());
                   ^
/usr/include/c++/v1/map:1006:68: 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>
<span class="quote">>::find<Key>' requested here</span >
    iterator find(const key_type& __k)             {return __tree_.find(__k);}
                                                                   ^
b.cpp:7:32: note: in instantiation of member function 'std::__1::map<Key, int,
std::__1::less<Key>, std::__1::allocator<std::__1::pair<const Key, int> >
<span class="quote">>::find'</span >
      requested here
auto it = std::map<Key, int>().find(Key(0));
                               ^
/usr/include/c++/v1/map:412:10: note: candidate function
    bool operator()(const _CP& __x, const _Key& __y) const
         ^
/usr/include/c++/v1/map:430:10: note: candidate function
    bool operator()(const _Key& __x, const _Key& __y) const
         ^
2 errors 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>