xref: /llvm-project/libcxx/test/std/utilities/function.objects/unord.hash/enum.compile.fail.cpp (revision fb855eb941b6d740cc6560297d0b4d3201dcaf9f)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <functional>
10 
11 //  Hashing a struct w/o a defined hash should fail.
12 
13 #include <functional>
14 #include <cassert>
15 #include <type_traits>
16 
17 struct X {};
18 
main(int,char **)19 int main(int, char**)
20 {
21     X x;
22     std::size_t h = std::hash<X>{} ( x );
23 
24   return 0;
25 }
26