15a83710eSEric Fiselier //===----------------------------------------------------------------------===//
25a83710eSEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65a83710eSEric Fiselier //
75a83710eSEric Fiselier //===----------------------------------------------------------------------===//
85a83710eSEric Fiselier 
95a83710eSEric Fiselier // <functional>
105a83710eSEric Fiselier 
115a83710eSEric Fiselier // modulus
125a83710eSEric Fiselier 
135a83710eSEric Fiselier #include <functional>
145a83710eSEric Fiselier #include <type_traits>
155a83710eSEric Fiselier #include <cassert>
165a83710eSEric Fiselier 
170f901c7eSStephan T. Lavavej #include "test_macros.h"
180f901c7eSStephan T. Lavavej 
19*2df59c50SJF Bastien int main(int, char**)
205a83710eSEric Fiselier {
215a83710eSEric Fiselier     typedef std::modulus<int> F;
225a83710eSEric Fiselier     const F f = F();
2366369c03SMarshall Clow     static_assert((std::is_same<int, F::first_argument_type>::value), "" );
2466369c03SMarshall Clow     static_assert((std::is_same<int, F::second_argument_type>::value), "" );
2566369c03SMarshall Clow     static_assert((std::is_same<int, F::result_type>::value), "" );
265a83710eSEric Fiselier     assert(f(36, 8) == 4);
270f901c7eSStephan T. Lavavej #if TEST_STD_VER > 11
285a83710eSEric Fiselier     typedef std::modulus<> F2;
295a83710eSEric Fiselier     const F2 f2 = F2();
305a83710eSEric Fiselier     assert(f2(36, 8) == 4);
315a83710eSEric Fiselier     assert(f2(36L, 8) == 4);
325a83710eSEric Fiselier     assert(f2(36, 8L) == 4);
335a83710eSEric Fiselier 
345a83710eSEric Fiselier     constexpr int foo = std::modulus<int> () (3, 2);
355a83710eSEric Fiselier     static_assert ( foo == 1, "" );
365a83710eSEric Fiselier 
375a83710eSEric Fiselier     constexpr int bar = std::modulus<> () (3L, 2);
385a83710eSEric Fiselier     static_assert ( bar == 1, "" );
395a83710eSEric Fiselier #endif
40*2df59c50SJF Bastien 
41*2df59c50SJF Bastien   return 0;
425a83710eSEric Fiselier }
43