<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - unordered_map doesn't work with an enum as key in C++11 mode"
   href="https://bugs.llvm.org/show_bug.cgi?id=50257">50257</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>unordered_map doesn't work with an enum as key in C++11 mode
          </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>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>ldionne@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>martin@martin.st
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>A test snippet like this compiles successfully in C++14 mode but not in C++11
mode:

#include <unordered_map>
enum MyEnum { A, B, C };
std::unordered_map<MyEnum, int> myMap;

In C++11 mode, it fails like this:

In file included from libcxx-unordered-map.cpp:1:
In file included from
/home/martin/clang-nightly/x86_64-w64-mingw32/include/c++/v1/unordered_map:435:
In file included from
/home/martin/clang-nightly/x86_64-w64-mingw32/include/c++/v1/__hash_table:15:
In file included from
/home/martin/clang-nightly/x86_64-w64-mingw32/include/c++/v1/memory:668:
/home/martin/clang-nightly/x86_64-w64-mingw32/include/c++/v1/type_traits:1811:38:
error: implicit instantiation of undefined template 'std::hash<MyEnum>'
    : public integral_constant<bool, __is_empty(_Tp)> {};
                                     ^
/home/martin/clang-nightly/x86_64-w64-mingw32/include/c++/v1/unordered_map:453:18:
note: in instantiation of template class 'std::is_empty<std::hash<MyEnum>>'
requested here
          bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value>
                 ^
/home/martin/clang-nightly/x86_64-w64-mingw32/include/c++/v1/unordered_map:936:13:
note: in instantiation of default argument for '__unordered_map_hasher<MyEnum,
std::__hash_value_type<MyEnum, int>, std::hash<MyEnum>, std::equal_to<MyEnum>>'
required here
    typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal>
__hasher;
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libcxx-unordered-map.cpp:3:33: note: in instantiation of template class
'std::unordered_map<MyEnum, int>' requested here
std::unordered_map<MyEnum, int> myMap;
                                ^
/home/martin/clang-nightly/x86_64-w64-mingw32/include/c++/v1/__memory/shared_ptr.h:1688:50:
note: template is declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
                                                 ^
1 error generated.


This causes build errors when building libaom since
<a href="https://aomedia-review.googlesource.com/c/aom/+/136604">https://aomedia-review.googlesource.com/c/aom/+/136604</a>.</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>