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 //===----------------------------------------------------------------------===//
8 #ifndef SUPPORT_USER_DEFINED_INTEGRAL_H
9 #define SUPPORT_USER_DEFINED_INTEGRAL_H
11 #include "test_macros.h"
14 struct UserDefinedIntegral
16 TEST_CONSTEXPR_CXX14
UserDefinedIntegral() : value(0) {}
17 TEST_CONSTEXPR_CXX14
UserDefinedIntegral(T v
) : value(v
) {}
18 TEST_CONSTEXPR_CXX14
operator T() const { return value
; }
22 // Poison the arithmetic and comparison operations
23 template <class T
, class U
>
24 void operator+(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
26 template <class T
, class U
>
27 void operator-(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
29 template <class T
, class U
>
30 void operator*(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
32 template <class T
, class U
>
33 void operator/(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
35 template <class T
, class U
>
36 void operator==(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
38 template <class T
, class U
>
39 void operator!=(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
41 template <class T
, class U
>
42 void operator<(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
44 template <class T
, class U
>
45 void operator>(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
47 template <class T
, class U
>
48 void operator<=(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
50 template <class T
, class U
>
51 void operator>=(UserDefinedIntegral
<T
>, UserDefinedIntegral
<U
>);
53 #endif // SUPPORT_USER_DEFINED_INTEGRAL_H