]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/20_util/function_objects/83607.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / function_objects / 83607.cc
CommitLineData
99dee823 1// Copyright (C) 2018-2021 Free Software Foundation, Inc.
32489ab5
JW
2//
3// This file is part of the GNU ISO C++ Library. This library is free
4// software; you can redistribute it and/or modify it under the
5// terms of the GNU General Public License as published by the
6// Free Software Foundation; either version 3, or (at your option)
7// any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License along
15// with this library; see the file COPYING3. If not see
16// <http://www.gnu.org/licenses/>.
17
18// { dg-options "-std=gnu++17" }
19// { dg-do compile { target c++17 } }
20
21#include <functional>
22#include <cstddef>
23
24// PR libstdc++/83607
25
26using std::boyer_moore_searcher;
27using std::boyer_moore_horspool_searcher;
28using std::byte;
29using std::hash;
30using std::equal_to;
31
32void
33test01()
34{
35 constexpr auto expected = sizeof(boyer_moore_searcher<const char*>);
36 static_assert(sizeof(boyer_moore_searcher<const long*>) != expected);
37 using T1 = boyer_moore_searcher<char*, hash<char>, equal_to<char>>;
38 static_assert(sizeof(T1) == expected);
39 using T2 = boyer_moore_searcher<byte*>;
40 static_assert(sizeof(T2) == expected);
41 using T3 = boyer_moore_searcher<const byte*>;
42 static_assert(sizeof(T3) == expected);
43 using T4 = boyer_moore_searcher<const byte*, hash<byte>, equal_to<byte>>;
44 static_assert(sizeof(T4) == expected);
45}
46
47void
48test02()
49{
50 constexpr auto expected = sizeof(boyer_moore_horspool_searcher<const char*>);
51 static_assert(sizeof(boyer_moore_horspool_searcher<const long*>) != expected);
52 using T1 = boyer_moore_horspool_searcher<char*, hash<char>, equal_to<char>>;
53 static_assert(sizeof(T1) == expected);
54 using T2 = boyer_moore_horspool_searcher<byte*>;
55 static_assert(sizeof(T2) == expected);
56 using T3 = boyer_moore_horspool_searcher<const byte*>;
57 static_assert(sizeof(T3) == expected);
58 using T4
59 = boyer_moore_horspool_searcher<const byte*, hash<byte>, equal_to<byte>>;
60 static_assert(sizeof(T4) == expected);
61}