libstdc++: [_Hashtable] Fix some implementation inconsistencies
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / ref-qual20.C
blob314f19bb864709bb6a8543f1b0305e4bb05c7aed
1 // PR c++/87109
2 // { dg-do run { target c++11 } }
4 #include <utility>
6 struct Y {
7   int y;
8   Y(int y_) : y(y_) { }
9 };
10 struct X : public Y {
11   int x;
12   X(int x_, int y_) : x(x_), Y(y_) { }
15 struct A {
16   operator X() & { return { 0, 2 }; }
17   operator X() && { return { 0, -1 }; }
21 f (A a)
23   return a;
27 f2 (A a)
29   return std::move (a);
33 f3 ()
35   A a;
36   return a;
40 f4 ()
42   A a;
43   return std::move (a);
47 f5 ()
49   return A();
52 int
53 main ()
55   int return_lval = -1;
56   Y y1 = f (A());
57   if (y1.y != return_lval)
58     __builtin_abort ();
59   Y y2 = f2 (A());
60   if (y2.y != -1)
61     __builtin_abort ();
62   Y y3 = f3 ();
63   if (y3.y != return_lval)
64     __builtin_abort ();
65   Y y4 = f4 ();
66   if (y4.y != -1)
67     __builtin_abort ();
68   Y y5 = f5 ();
69   if (y5.y != -1)
70     __builtin_abort ();