1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef SUPPORT_USER_DEFINED_INTEGRAL_H
10 #define SUPPORT_USER_DEFINED_INTEGRAL_H
12 #include "test_macros.h"
15 struct UserDefinedIntegral
17 TEST_CONSTEXPR_CXX14
UserDefinedIntegral() : value(0) {}
18 TEST_CONSTEXPR_CXX14
UserDefinedIntegral(T v
) : value(v
) {}
19 TEST_CONSTEXPR_CXX14
operator T() const { return value
; }
23 // Poison the arithmetic and comparison operations
24 template <class T
, class U
>
25 void operator+(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
27 template <class T
, class U
>
28 void operator-(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
30 template <class T
, class U
>
31 void operator*(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
33 template <class T
, class U
>
34 void operator/(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
36 template <class T
, class U
>
37 void operator==(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
39 template <class T
, class U
>
40 void operator!=(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
42 template <class T
, class U
>
43 void operator<(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
45 template <class T
, class U
>
46 void operator>(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
48 template <class T
, class U
>
49 void operator<=(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
51 template <class T
, class U
>
52 void operator>=(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
54 #endif // SUPPORT_USER_DEFINED_INTEGRAL_H