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