libstdc++: [_Hashtable] Fix some implementation inconsistencies
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / named.C
blob7bd209339484153436d82de3849af834d2488cfb
1 // { dg-do link { target c++11 } }
3 template<typename _Tp>
4 inline _Tp&&
5 movel(_Tp& __t)
6 { return static_cast<_Tp&&>(__t); }
8 struct S {};
9 struct T
11   T(S && s_) : s(movel(s_)) {}
12   S && get() { return movel(s); }
13   operator S&&() { return movel(s); }
14   S && s;
15   S s2;
18 void named(S const &) {}
19 void named(S&&);
21 void unnamed(S const &);
22 void unnamed(S&&) {}
24 void f(S && p)
26   S && s(movel(p));
27   T t(movel(s));
29   named(s);                          // variable reference
30   named(p);                          // parameter reference
31   named(t.s);                        // class member access
33   unnamed(t.get());                  // function return
34   unnamed(t);                        // implicit conversion
35   unnamed(static_cast<S&&>(s));      // cast to rvalue
36   unnamed(static_cast<T&&>(t).s2);   // cast to rvalue
39 int main()