1 // { dg-do run { target c++11 } }
2 
3 // Test user-defined literals.
4 // Test simple operator declaration and definition in namespaces.
5 
6 #include <cmath>
7 #include <limits>
8 
9 namespace Long
10 {
11   long double operator"" _LL(long double);
12 }
13 
14 namespace Short
15 {
16   short
17   operator"" _SS(long double x)
18   { return std::fmod(x, static_cast<long double>(std::numeric_limits<short>::max())); }
19 }
20 
21 void
test1()22 test1()
23 {
24   long double x = Long::operator "" _LL(1.2L);
25 
26   using namespace Short;
27   short s = operator"" _SS(1.2L);
28   short s2 = 1.2_SS;
29 }
30 
31 int
main()32 main()
33 {
34   test1();
35 }
36 
37 namespace Long
38 {
39   long double
40   operator"" _LL(long double x)
41   { return x + 2.0L; }
42 }
43