Home | History | Annotate | Download | only in unord.map.cnstr
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // UNSUPPORTED: c++98, c++03
     11 // The test requires access control SFINAE.
     12 
     13 // <unordered_map>
     14 
     15 // Check that std::unordered_map fails to instantiate if the hash function is
     16 // not copy-constructible. This is mentioned in LWG issue 2436
     17 
     18 #include <unordered_map>
     19 
     20 template <class T>
     21 struct Hash {
     22     std::size_t operator () (const T& lhs) const { return 0; }
     23 
     24     Hash () {}
     25 private:
     26     Hash (const Hash &); // declared but not defined
     27 };
     28 
     29 
     30 int main() {
     31     std::unordered_map<int, int, Hash<int> > m;
     32 }
     33