1330ab33fSMarshall Clow //===----------------------------------------------------------------------===//
2330ab33fSMarshall Clow //
3330ab33fSMarshall Clow // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4330ab33fSMarshall Clow // See https://llvm.org/LICENSE.txt for license information.
5330ab33fSMarshall Clow // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6330ab33fSMarshall Clow //
7330ab33fSMarshall Clow //===----------------------------------------------------------------------===//
8330ab33fSMarshall Clow //
9*31cbe0f2SLouis Dionne // UNSUPPORTED: c++03, c++11, c++14, c++17
10330ab33fSMarshall Clow // <numeric>
11330ab33fSMarshall Clow
12330ab33fSMarshall Clow // template <class _Tp>
13330ab33fSMarshall Clow // _Tp midpoint(_Tp __a, _Tp __b) noexcept
14330ab33fSMarshall Clow
15330ab33fSMarshall Clow // An overload exists for each of char and all arithmetic types except bool.
16330ab33fSMarshall Clow
17330ab33fSMarshall Clow #include <numeric>
18330ab33fSMarshall Clow
19330ab33fSMarshall Clow #include "test_macros.h"
20330ab33fSMarshall Clow
func1()216b03a1b4SMarshall Clow int func1 () { return 1; }
func2()226b03a1b4SMarshall Clow int func2 () { return 2; }
236b03a1b4SMarshall Clow
246b03a1b4SMarshall Clow struct Incomplete;
256b03a1b4SMarshall Clow Incomplete *ip = nullptr;
266b03a1b4SMarshall Clow void *vp = nullptr;
276b03a1b4SMarshall Clow
main(int,char **)28330ab33fSMarshall Clow int main(int, char**)
29330ab33fSMarshall Clow {
30330ab33fSMarshall Clow (void) std::midpoint(false, true); // expected-error {{no matching function for call to 'midpoint'}}
31330ab33fSMarshall Clow
32330ab33fSMarshall Clow // A couple of odd pointer types that should fail
33330ab33fSMarshall Clow (void) std::midpoint(nullptr, nullptr); // expected-error {{no matching function for call to 'midpoint'}}
346b03a1b4SMarshall Clow (void) std::midpoint(func1, func2); // expected-error {{no matching function for call to 'midpoint'}}
356b03a1b4SMarshall Clow (void) std::midpoint(ip, ip); // expected-error {{no matching function for call to 'midpoint'}}
366b03a1b4SMarshall Clow (void) std::midpoint(vp, vp); // expected-error {{no matching function for call to 'midpoint'}}
37330ab33fSMarshall Clow
38330ab33fSMarshall Clow return 0;
39330ab33fSMarshall Clow }
40