Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / cpp0x / udlit-namespace.C
blobfcaa41a4da870432842e5062b3ddf12d2d3655d1
1 // { dg-do run { target c++11 } }
2 // { dg-skip-if "requires hosted libstdc++ for cmath" { ! hostedlib } }
4 // Test user-defined literals.
5 // Test simple operator declaration and definition in namespaces.
7 #include <cmath>
8 #include <limits>
10 namespace Long
12   long double operator ""_LL(long double);
15 namespace Short
17   short
18   operator ""_SS(long double x)
19   { return std::fmod(x, static_cast<long double>(std::numeric_limits<short>::max())); }
22 void
23 test1()
25   long double x = Long::operator ""_LL(1.2L);
27   using namespace Short;
28   short s = operator ""_SS(1.2L);
29   short s2 = 1.2_SS;
32 int
33 main()
35   test1();
38 namespace Long
40   long double
41   operator ""_LL(long double x)
42   { return x + 2.0L; }