Debian Codegraph @

gcc/testsuite/g++.target/i386/excess-precision-5.C

raw
1 // Excess precision tests. Verify excess precision doesn't affect
2 // actual types.
3 // { dg-do compile { target c++11 } }
4 // { dg-options "-mfpmath=387 -fexcess-precision=standard" }
5
6 namespace std {
7 template<typename T, T v> struct integral_constant {
8 static constexpr T value = v;
9 };
10 typedef integral_constant<bool, false> false_type;
11 typedef integral_constant<bool, true> true_type;
12 template<class T, class U>
13 struct is_same : std::false_type {};
14 template <class T>
15 struct is_same<T, T> : std::true_type {};
16 }
17
18 float f;
19 double d;
20
21 void
22 test_types (void)
23 {
24 #define CHECK_FLOAT(E) static_assert (std::is_same <float, decltype (E)>::value, "")
25 #define CHECK_DOUBLE(E) static_assert (std::is_same <double, decltype (E)>::value, "")
26 CHECK_FLOAT (f + f);
27 CHECK_DOUBLE (d + d);
28 CHECK_FLOAT (f * f / f);
29 CHECK_DOUBLE (d * d / d);
30 CHECK_FLOAT (f ? f - f : f);
31 CHECK_DOUBLE (d ? d - d : d);
32 }