blob: 0f6297a05cb67e3e8e3ef164cb6b3c057285fa77 [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnant5b08a8a2010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnant3e519522010-05-11 19:42:16 +00004//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <fenv.h>
11
12#include <fenv.h>
13#include <type_traits>
14
15#ifndef FE_DIVBYZERO
16#error FE_DIVBYZERO not defined
17#endif
18
19#ifndef FE_INEXACT
20#error FE_INEXACT not defined
21#endif
22
23#ifndef FE_INVALID
24#error FE_INVALID not defined
25#endif
26
27#ifndef FE_OVERFLOW
28#error FE_OVERFLOW not defined
29#endif
30
31#ifndef FE_UNDERFLOW
32#error FE_UNDERFLOW not defined
33#endif
34
35#ifndef FE_ALL_EXCEPT
36#error FE_ALL_EXCEPT not defined
37#endif
38
39#ifndef FE_DOWNWARD
40#error FE_DOWNWARD not defined
41#endif
42
43#ifndef FE_TONEAREST
44#error FE_TONEAREST not defined
45#endif
46
47#ifndef FE_TOWARDZERO
48#error FE_TOWARDZERO not defined
49#endif
50
51#ifndef FE_UPWARD
52#error FE_UPWARD not defined
53#endif
54
55#ifndef FE_DFL_ENV
56#error FE_DFL_ENV not defined
57#endif
58
59int main()
60{
61 fenv_t fenv = {0};
62 fexcept_t fex = 0;
63 static_assert((std::is_same<decltype(feclearexcept(0)), int>::value), "");
64 static_assert((std::is_same<decltype(fegetexceptflag(&fex, 0)), int>::value), "");
65 static_assert((std::is_same<decltype(feraiseexcept(0)), int>::value), "");
66 static_assert((std::is_same<decltype(fesetexceptflag(&fex, 0)), int>::value), "");
67 static_assert((std::is_same<decltype(fetestexcept(0)), int>::value), "");
68 static_assert((std::is_same<decltype(fegetround()), int>::value), "");
69 static_assert((std::is_same<decltype(fesetround(0)), int>::value), "");
70 static_assert((std::is_same<decltype(fegetenv(&fenv)), int>::value), "");
71 static_assert((std::is_same<decltype(feholdexcept(&fenv)), int>::value), "");
72 static_assert((std::is_same<decltype(fesetenv(&fenv)), int>::value), "");
73 static_assert((std::is_same<decltype(feupdateenv(&fenv)), int>::value), "");
74}