]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/23_containers/unordered_set/not_default_constructible_hash_neg.cc
Update copyright years in libstdc++-v3/
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 23_containers / unordered_set / not_default_constructible_hash_neg.cc
CommitLineData
5b3be7cf
FD
1// { dg-do compile }
2// { dg-options "-std=c++11" }
3// { dg-require-normal-mode "" }
4
aa118a03 5// Copyright (C) 2013-2014 Free Software Foundation, Inc.
5b3be7cf
FD
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.
12
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.
17
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/>.
21
da2e6991 22// { dg-error "default constructible" "" { target *-*-* } 287 }
5b3be7cf
FD
23
24#include <unordered_set>
25
26namespace
27{
28 struct hash
29 {
30 hash(std::size_t seed)
31 : _M_seed(seed)
32 { }
33
34 std::size_t operator() (int val) const noexcept
35 { return val ^ _M_seed; }
36
37 private:
38 std::size_t _M_seed;
39 };
40}
41
42void
43test01()
44{
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>;
49
50 hashtable ht(10, hash(1));
51}