2013-04-22 François Dumont <fdumont@gcc.gnu.org>
[official-gcc.git] / libstdc++-v3 / testsuite / 23_containers / unordered_set / not_default_constructible_hash_neg.cc
blob7590344b61a71bc6957c560edaa6085c74f59086
1 // { dg-do compile }
2 // { dg-options "-std=c++11" }
3 // { dg-require-normal-mode "" }
5 // Copyright (C) 2013 Free Software Foundation, Inc.
6 //
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 3, or (at your option)
11 // any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING3. If not see
20 // <http://www.gnu.org/licenses/>.
22 // { dg-error "default constructible" "" { target *-*-* } 272 }
24 #include <unordered_set>
26 namespace
28 struct hash
30 hash(std::size_t seed)
31 : _M_seed(seed)
32 { }
34 std::size_t operator() (int val) const noexcept
35 { return val ^ _M_seed; }
37 private:
38 std::size_t _M_seed;
42 void
43 test01()
45 using traits = std::__detail::_Hashtable_traits<false, true, true>;
46 using hashtable = std::__uset_hashtable<int, hash,
47 std::equal_to<int>,
48 std::allocator<int>, traits>;
50 hashtable ht(10, hash(1));