diff --git a/gdb/testsuite/gdb.cp/casts.cc b/gdb/testsuite/gdb.cp/casts.cc
index 43f112f..d15fed1 100644
--- a/gdb/testsuite/gdb.cp/casts.cc
+++ b/gdb/testsuite/gdb.cp/casts.cc
@@ -1,3 +1,5 @@
+#include <utility>
+
 struct A
 {
   int a;
@@ -37,7 +39,7 @@ struct DoublyDerived : public VirtuallyDerived,
 // Confuse a simpler approach.
 
 double
-decltype(int x)
+decl_type(int x)
 {
   return x + 2.0;
 }
@@ -49,6 +51,8 @@ main (int argc, char **argv)
   B *b = (B *) a;
   A &ar = *b;
   B &br = (B&)ar;
+  A &&arr = std::move(A(42));
+  B &&brr = std::move(B(42, 1729));
 
   Derived derived;
   DoublyDerived doublyderived;
@@ -56,7 +60,7 @@ main (int argc, char **argv)
   Alpha *ad = &derived;
   Alpha *add = &doublyderived;
 
-  double y = decltype(2);
+  double y = decl_type(2);
 
   return 0;  /* breakpoint spot: casts.exp: 1 */
 }
diff --git a/gdb/testsuite/gdb.cp/casts.exp b/gdb/testsuite/gdb.cp/casts.exp
index 34a2492..2000b77 100644
--- a/gdb/testsuite/gdb.cp/casts.exp
+++ b/gdb/testsuite/gdb.cp/casts.exp
@@ -33,7 +33,8 @@ if [get_compiler_info "c++"] {
     return -1
 }
 
-if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
+if {[prepare_for_testing $testfile.exp $testfile $srcfile \
+    {debug c++ additional_flags="-std=c++11"}]} {
     return -1
 }
 
@@ -86,6 +87,18 @@ gdb_test "print (B &) ar" ".* = .B.* {<A> = {a = 42}, b = 1729}" \
 gdb_test "print br" ".* = .B.* {<A> = {a = 42}, b = 1729}" \
     "let compiler cast base class reference to derived class reference"
 
+# Casting Rvalue References.
+# Check upcasting.
+gdb_test "print (A &&) br" ".* = .A &&.* {a = 42}" \
+    "cast derived class rvalue reference to base class rvalue reference"
+
+# Check downcasting.
+gdb_test "print (B &&) ar" ".* = .B.* {<A> = {a = 42}, b = 1729}" \
+    "cast base class rvalue reference to derived class rvalue reference"
+
+# Check compiler casting
+gdb_test "print br" ".* = .B.* {<A> = {a = 42}, b = 1729}" \
+    "let compiler cast base class rvalue reference to derived class rvalue reference"
 
 # A few basic tests of "new" casts.
 
@@ -101,6 +114,9 @@ gdb_test "print static_cast<A *> (b)" " = \\(A \\*\\) $hex" \
 gdb_test "print static_cast<A &> (*b)" " = \\(A \\&\\) @$hex: {a = 42}" \
     "static_cast to reference type"
 
+gdb_test "print static_cast<A &&> (*b)" " = \\(A \\&\\&\\) @$hex: {a = 42}" \
+    "static_cast to rvalue reference type"
+
 gdb_test "print reinterpret_cast<A *> (b)" " = \\(A \\*\\) $hex" \
     "basic test of reinterpret_cast"
 
@@ -110,13 +126,16 @@ gdb_test "print reinterpret_cast<void> (b)" "Invalid reinterpret_cast" \
 gdb_test "print reinterpret_cast<A &> (*b)" " = \\(A \\&\\) @$hex: {a = 42}" \
     "reinterpret_cast to reference type"
 
+gdb_test "print reinterpret_cast<A &&> (*b)" " = \\(A \\&\\&\\) @$hex: {a = 42}" \
+    "reinterpret_cast to rvalue reference type"
+
 # Test that keyword shadowing works.
 
-gdb_test "whatis decltype(5)" " = double"
+gdb_test "whatis decl_type(5)" " = double"
 
 # Basic tests using typeof.
 
-foreach opname {__typeof__ __typeof __decltype} {
+foreach opname {__typeof__ __typeof decltype} {
     gdb_test "print (${opname}(a)) (b)" " = \\(A \\*\\) $hex" \
 	"old-style cast using $opname"
 
@@ -127,7 +146,7 @@ foreach opname {__typeof__ __typeof __decltype} {
 	"reinterpret_cast using $opname"
 }
 
-gdb_test "whatis __decltype(*a)" "type = A \\&"
+gdb_test "whatis decltype(*a)" "type = A \\&"
 
 # Tests of dynamic_cast.
 
@@ -153,6 +172,10 @@ gdb_test "print dynamic_cast<Alpha &> (derived)" \
     " = \\(Alpha \\&\\) @$nonzero_hex: {.* = ${nonzero_hex}( <vtable for Derived.*>)?}" \
     "dynamic_cast simple upcast to reference"
 
+gdb_test "print dynamic_cast<Alpha &&> (derived)" \
+    " = \\(Alpha \\&\\&\\) @$nonzero_hex: {.* = ${nonzero_hex}( <vtable for Derived.*>)?}" \
+    "dynamic_cast simple upcast to rvalue reference"
+
 gdb_test "print dynamic_cast<Derived *> (ad)" \
     " = \\(Derived \\*\\) ${nonzero_hex}( <vtable for Derived.*>)?" \
     "dynamic_cast simple downcast"
@@ -169,6 +192,10 @@ gdb_test "print dynamic_cast<VirtuallyDerived &> (*ad)" \
     "dynamic_cast failed" \
     "dynamic_cast to reference to non-existing base"
 
+gdb_test "print dynamic_cast<VirtuallyDerived &&> (*ad)" \
+    "dynamic_cast failed" \
+    "dynamic_cast to rvalue reference to non-existing base"
+
 gdb_test "print dynamic_cast<DoublyDerived *> (add)" \
     " = \\(DoublyDerived \\*\\) ${nonzero_hex}( <vtable for DoublyDerived.*>)?" \
     "dynamic_cast unique downcast"
diff --git a/gdb/testsuite/gdb.cp/cpsizeof.cc b/gdb/testsuite/gdb.cp/cpsizeof.cc
index 2dcaea1..6a8de4a 100644
--- a/gdb/testsuite/gdb.cp/cpsizeof.cc
+++ b/gdb/testsuite/gdb.cp/cpsizeof.cc
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include <utility>
+
 struct Class
 {
   int a;
@@ -44,8 +46,10 @@ typedef Enum e12[12];
 #define T(N)					\
   N N ## obj;					\
   N& N ## _ref = N ## obj;			\
+  N&& N ## _rref = std::move(N ## obj);         \
   N* N ## p = &(N ## obj);			\
   N*& N ## p_ref = N ## p;			\
+  N*&& N ## p_rref = std::move(N ## p);         \
   int size_ ## N = sizeof (N ## _ref);		\
   int size_ ## N ## p = sizeof (N ## p_ref);	\
 
diff --git a/gdb/testsuite/gdb.cp/cpsizeof.exp b/gdb/testsuite/gdb.cp/cpsizeof.exp
index de95c49..47c841e 100644
--- a/gdb/testsuite/gdb.cp/cpsizeof.exp
+++ b/gdb/testsuite/gdb.cp/cpsizeof.exp
@@ -18,7 +18,8 @@ standard_testfile .cc
 
 if {[skip_cplus_tests]} { continue }
 
-if {[prepare_for_testing ${testfile}.exp $testfile $srcfile {debug c++}] } {
+if {[prepare_for_testing ${testfile}.exp $testfile $srcfile \
+    {debug c++ additional_flags="-std=c++11"}] } {
      return -1
 }
 
diff --git a/gdb/testsuite/gdb.cp/demangle.exp b/gdb/testsuite/gdb.cp/demangle.exp
index 96c90db..c007097 100644
--- a/gdb/testsuite/gdb.cp/demangle.exp
+++ b/gdb/testsuite/gdb.cp/demangle.exp
@@ -123,20 +123,27 @@ proc test_gnu_style_demangling {} {
     test_demangling "gnu: Append__15NameChooserViewPCc" \
 	"NameChooserView::Append\[(\]+(const char|char const) \[*\]+\[)\]+"
     test_demangling_exact "gnu: ArrowheadIntersects__9ArrowLineP9ArrowheadR6BoxObjP7Graphic" "ArrowLine::ArrowheadIntersects(Arrowhead *, BoxObj &, Graphic *)"
+    test_demangling_exact "gnu-v3: _ZN9ArrowLine19ArrowheadIntersectsEP9ArrowheadO6BoxObjP7Graphic" "ArrowLine::ArrowheadIntersects(Arrowhead*, BoxObj&&, Graphic*)"
     test_demangling_exact "gnu: AtEnd__13ivRubberGroup" "ivRubberGroup::AtEnd(void)"
     test_demangling_exact "gnu: BgFilter__9ivTSolverP12ivInteractor" "ivTSolver::BgFilter(ivInteractor *)"
     test_demangling "gnu: BitPatterntoa__FRC10BitPatternccc" \
 	"BitPatterntoa\[(\]+(const BitPattern|BitPattern const) &, char, char, char\[)\]+"
+    test_demangling "gnu-v3: _Z13BitPatterntoaOK10BitPatternccc" \
+	"BitPatterntoa\[(\]+(const BitPattern|BitPattern const)&&, char, char, char\[)\]+"
     test_demangling_exact "gnu: Check__6UArrayi" "UArray::Check(int)"
     test_demangling_exact "gnu: CoreConstDecls__8TextCodeR7ostream" "TextCode::CoreConstDecls(ostream &)"
+    test_demangling_exact "gnu-v3: _ZN8TextCode14CoreConstDeclsEO7ostream" "TextCode::CoreConstDecls(ostream&&)"
     test_demangling_exact "gnu: Detach__8StateVarP12StateVarView" "StateVar::Detach(StateVarView *)"
     test_demangling_exact "gnu: Done__9ComponentG8Iterator" "Component::Done(Iterator)"
     test_demangling "gnu: DrawDestinationTransformedImage__FP7_XImageiiT0iiUlUiiiUiUlUlP4_XGCRC13ivTransformeriiii" \
 	"DrawDestinationTransformedImage\[(\]+_XImage \[*\]+, int, int, _XImage \[*\]+, int, int, unsigned long, unsigned int, int, int, unsigned int, unsigned long, unsigned long, _XGC \[*\]+, (const ivTransformer|ivTransformer const) &, int, int, int, int\[)\]+"
+    test_demangling "gnu-v3: _Z31DrawDestinationTransformedImageP7_XImageiiS0_iimjiijmmP4_XGCOK13ivTransformeriiii" \
+	"DrawDestinationTransformedImage\[(\]+_XImage\[*\]+, int, int, _XImage\[*\]+, int, int, unsigned long, unsigned int, int, int, unsigned int, unsigned long, unsigned long, _XGC\[*\]+, (const ivTransformer|ivTransformer const)&&, int, int, int, int\[)\]+"
 
     test_demangling "gnu: Edit__12StringEditorPCcii" \
 	"StringEditor::Edit\[(\]+(const char|char const) \[*\]+, int, int\[)\]+"
     test_demangling_exact "gnu: Effect__11RelateManipR7ivEvent" "RelateManip::Effect(ivEvent &)"
+    test_demangling_exact "gnu-v3: _ZN11RelateManip6EffectEO7ivEvent" "RelateManip::Effect(ivEvent&&)"
     test_demangling "gnu: FilterName__FPCc" \
 	"FilterName\[(\]+(const char|char const) \[*\]+\[)\]+"
     test_demangling "gnu: Filter__6PSTextPCci" \
@@ -206,16 +213,21 @@ proc test_gnu_style_demangling {} {
 	"iv2_6_MenuItem::iv2_6_MenuItem\[(\]+int, (const char|char const) \[*\]+, ivInteractor \[*\]+\[)\]+"
 
     test_demangling_exact "gnu: __20DisplayList_IteratorR11DisplayList" "DisplayList_Iterator::DisplayList_Iterator(DisplayList &)"
+    test_demangling_exact "gnu-v3: _ZN20DisplayList_IteratorC4EO11DisplayList" "DisplayList_Iterator::DisplayList_Iterator(DisplayList&&)"
     test_demangling_exact "gnu: __3fooRT0" "foo::foo(foo &)"
+    test_demangling_exact "gnu-v3: _ZN3fooC4EOS_" "foo::foo(foo&&)"
     test_demangling_exact "gnu: __3fooiN31" "foo::foo(int, int, int, int)"
     test_demangling "gnu: __3fooiPCc" \
 	"foo::foo\[(\]+int, (const char|char const) \[*\]+\[)\]+"
     test_demangling_exact "gnu: __3fooiRT0iT2iT2" "foo::foo(int, foo &, int, foo &, int, foo &)"
+    test_demangling_exact "gnu-v3: _ZN3fooC4EiOS_iS0_iS0_" "foo::foo(int, foo&&, int, foo&&, int, foo&&)"
     test_demangling "gnu: __6GetOptiPPcPCc" \
 	"GetOpt::GetOpt\[(\]+int, char \[*\]+\[*\]+, (const char|char const) \[*\]+\[)\]+"
     test_demangling_exact "gnu: __6KeyMapPT0" "KeyMap::KeyMap(KeyMap *)"
     test_demangling "gnu: __7ivWorldPCcRiPPcPC12ivOptionDescPC14ivPropertyData" \
 	"ivWorld::ivWorld\[(\]+(const char|char const) \[*\]+, int &, char \[*\]+\[*\]+, (const ivOptionDesc|ivOptionDesc const) \[*\]+, (const ivPropertyData|ivPropertyData const) \[*\]+\[)\]+"
+    test_demangling "gnu-v3: _ZN7ivWorldC2EPKcOiPPcPK12ivOptionDescPK14ivPropertyData" \
+	"ivWorld::ivWorld\[(\]+(const char|char const)\[*\]+, int&&, char\[*\]+\[*\]+, (const ivOptionDesc|ivOptionDesc const)\[*\]+, (const ivPropertyData|ivPropertyData const)\[*\]+\[)\]+"
     test_demangling "gnu: __7procbufPCci" \
 	"procbuf::procbuf\[(\]+(const char|char const) \[*\]+, int\[)\]+"
     test_demangling_exact "gnu: __8ArrowCmdP6EditorUiUi" "ArrowCmd::ArrowCmd(Editor *, unsigned int, unsigned int)"
@@ -295,6 +307,8 @@ proc test_gnu_style_demangling {} {
     test_demangling_exact "gnu: append__7ivGlyphPT0" "ivGlyph::append(ivGlyph *)"
     test_demangling "gnu: arg__FRC7Complex" \
 	"arg\[(\]+(const Complex|Complex const) &\[)\]+"
+    test_demangling "gnu-v3: _Z3argOK7Complex" \
+	"arg\[(\]+(const Complex|Complex const)&&\[)\]+"
     test_demangling_exact "gnu: clearok__FP7_win_sti" "clearok(_win_st *, int)"
 
     test_demangling_exact "gnu: complexfunc2__FPFPc_i" "complexfunc2(int (*)(char *))"
@@ -305,10 +319,16 @@ proc test_gnu_style_demangling {} {
     test_demangling_exact "gnu: complexfunc7__FPFPFPc_i_PFl_i" "complexfunc7(int (*(*)(int (*)(char *)))(long))"
     test_demangling "gnu: contains__C9BitStringRC10BitPattern" \
 	"BitString::contains\[(\]+(const BitPattern|BitPattern const) &\[)\]+ const"
+    test_demangling "gnu-v3: _ZNK9BitString8containsEOK10BitPattern" \
+	"BitString::contains\[(\]+(const BitPattern|BitPattern const)&&\[)\]+ const"
     test_demangling "gnu: contains__C9BitStringRC12BitSubStringi" \
 	"BitString::contains\[(\]+(const BitSubString|BitSubString const) &, int\[)\]+ const"
+    test_demangling "gnu-v3: _ZNK9BitString8containsEOK12BitSubStringi" \
+	"BitString::contains\[(\]+(const BitSubString|BitSubString const)&&, int\[)\]+ const"
     test_demangling "gnu: contains__C9BitStringRT0" \
 	"BitString::contains\[(\]+(const BitString|BitString const) &\[)\]+ const"
+    test_demangling "gnu-v3: _ZNK9BitString8containsEOKS_" \
+	"BitString::contains\[(\]+(const BitString|BitString const)&&\[)\]+ const"
     test_demangling "gnu: div__FPC6IntRepT0P6IntRep" \
 	"div\[(\]+(const IntRep|IntRep const) \[*\]+, (const IntRep|IntRep const) \[*\]+, IntRep \[*\]+\[)\]+"
     test_demangling "gnu: div__FPC6IntReplP6IntRep" \
@@ -436,18 +456,26 @@ proc test_gnu_style_demangling {} {
 
     test_demangling_exact "gnu: __Q2t4List1Z10VHDLEntity3PixRCQ2t4List1Z10VHDLEntity3Pix" \
 	"List<VHDLEntity>::Pix::Pix(List<VHDLEntity>::Pix const &)"
+    test_demangling_exact "gnu-v3: _ZN4ListI10VHDLEntityE3PixC4EOKS2_" \
+	"List<VHDLEntity>::Pix::Pix(List<VHDLEntity>::Pix const&&)"
 
     test_demangling_exact "gnu: __Q2t4List1Z10VHDLEntity7elementRC10VHDLEntityPT0" \
 	"List<VHDLEntity>::element::element(VHDLEntity const &, List<VHDLEntity>::element *)"
+    test_demangling_exact "gnu-v3: _ZN4ListI10VHDLEntityE7elementC2EOKS0_PS2_" \
+	"List<VHDLEntity>::element::element(VHDLEntity const&&, List<VHDLEntity>::element*)"
 
     test_demangling_exact "gnu: __Q2t4List1Z10VHDLEntity7elementRCQ2t4List1Z10VHDLEntity7element" \
 	"List<VHDLEntity>::element::element(List<VHDLEntity>::element const &)"
+    test_demangling_exact "gnu-v3: _ZN4ListI10VHDLEntityE7elementC4EOKS2_" \
+	"List<VHDLEntity>::element::element(List<VHDLEntity>::element const&&)"
 
     test_demangling_exact "gnu: __cl__C11VHDLLibraryGt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
 	"VHDLLibrary::operator()(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >) const"
 
     test_demangling_exact "gnu: __cl__Ct4List1Z10VHDLEntityRCQ2t4List1Z10VHDLEntity3Pix" \
 	"List<VHDLEntity>::operator()(List<VHDLEntity>::Pix const &) const"
+    test_demangling_exact "gnu-v3: _ZNK4ListI10VHDLEntityEclEOKNS1_3PixE" \
+	"List<VHDLEntity>::operator()(List<VHDLEntity>::Pix const&&) const"
 
     test_demangling_exact "gnu: __ne__FPvRCQ2t4List1Z10VHDLEntity3Pix" \
 	"operator!=(void *, List<VHDLEntity>::Pix const &)"
@@ -457,6 +485,8 @@ proc test_gnu_style_demangling {} {
 
     test_demangling_exact "gnu: __t4List1Z10VHDLEntityRCt4List1Z10VHDLEntity" \
 	"List<VHDLEntity>::List(List<VHDLEntity> const &)"
+    test_demangling_exact "gnu-v3: _ZN4ListI10VHDLEntityEC4EOKS1_" \
+	"List<VHDLEntity>::List(List<VHDLEntity> const&&)"
 
     test_demangling_exact "gnu: __t4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
 	"PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >::PixX(void)"
@@ -466,12 +496,18 @@ proc test_gnu_style_demangling {} {
 
     test_demangling_exact "gnu: __t4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntityRCt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
 	"PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >::PixX(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> > const &)"
+    test_demangling_exact "gnu-v3: _ZN4PixXI11VHDLLibrary14VHDLLibraryRep4ListI10VHDLEntityEEC2EOKS5_" \
+	"PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >::PixX(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> > const&&)"
 
     test_demangling_exact "gnu: nextE__C11VHDLLibraryRt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
 	"VHDLLibrary::nextE(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> > &) const"
+    test_demangling_exact "gnu-v3: _ZNK11VHDLLibrary5nextEEO4PixXIS_14VHDLLibraryRep4ListI10VHDLEntityEE" \
+	"VHDLLibrary::nextE(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >&&) const"
 
     test_demangling_exact "gnu: next__Ct4List1Z10VHDLEntityRQ2t4List1Z10VHDLEntity3Pix" \
 	"List<VHDLEntity>::next(List<VHDLEntity>::Pix &) const"
+    test_demangling_exact "gnu-v3: _ZNK4ListI10VHDLEntityE4nextEONS1_3PixE" \
+	"List<VHDLEntity>::next(List<VHDLEntity>::Pix&&) const"
 
     test_demangling_exact "gnu: _GLOBAL_\$D\$set" "global destructors keyed to set"
 
diff --git a/gdb/testsuite/gdb.cp/overload.cc b/gdb/testsuite/gdb.cp/overload.cc
index 5c782a4..05cbded 100644
--- a/gdb/testsuite/gdb.cp/overload.cc
+++ b/gdb/testsuite/gdb.cp/overload.cc
@@ -1,10 +1,12 @@
 #include <stddef.h>
+#include <utility>
 
 class foo {
 public:
   foo  (int);
   foo  (int, const char *);
   foo  (foo&);
+  foo  (foo&&);
   ~foo ();
   void foofunc (int);
   void foofunc (int, signed char *);
@@ -27,6 +29,14 @@ int overload1arg (double);
 int overload1arg (int*);
 int overload1arg (void*);
 
+typedef foo &foo_lval_ref;
+typedef foo &&foo_rval_ref;
+
+int overload1arg (foo &);
+int overload1arg (foo &&);
+int overload1arg (foo_lval_ref);
+int overload1arg (foo_rval_ref);
+
 int overloadfnarg (void);
 int overloadfnarg (int);
 int overloadfnarg (int, int (*) (int));
@@ -114,6 +124,7 @@ int main ()
     double arg12 = 200.0;
     int arg13 = 200;
     char arg14 = 'a';
+    foo arg15(5);
 
     A a;
     B b;
@@ -153,6 +164,7 @@ int main ()
 foo::foo  (int i)                  { ifoo = i; ccpfoo = NULL; }
 foo::foo  (int i, const char *ccp) { ifoo = i; ccpfoo = ccp; }
 foo::foo  (foo& afoo)              { ifoo = afoo.ifoo; ccpfoo = afoo.ccpfoo;}
+foo::foo  (foo&& afoo)             { ifoo = std::move(afoo.ifoo); ccpfoo = std::move (afoo.ccpfoo); }
 foo::~foo ()                       {}
 
 
@@ -172,6 +184,8 @@ int foo::overload1arg (float arg)           { arg = 0; return 11;}
 int foo::overload1arg (double arg)          { arg = 0; return 12;}
 int foo::overload1arg (int* arg)            { arg = 0; return 13;}
 int foo::overload1arg (void* arg)           { arg = 0; return 14;}
+int foo::overload1arg (foo &arg)            { return 15; }
+int foo::overload1arg (foo &&arg)           { return 16; }
 
 /* Test to see that we can explicitly request overloaded functions
    with function pointers in the prototype. */
diff --git a/gdb/testsuite/gdb.cp/overload.exp b/gdb/testsuite/gdb.cp/overload.exp
index 0cfa638..a1fa4ef 100644
--- a/gdb/testsuite/gdb.cp/overload.exp
+++ b/gdb/testsuite/gdb.cp/overload.exp
@@ -28,7 +28,8 @@ if { [skip_cplus_tests] } { continue }
 
 standard_testfile .cc
 
-if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
+if {[prepare_for_testing $testfile.exp $testfile $srcfile \
+    {debug c++ additional_flags="-std=c++11"}]} {
     return -1
 }
 
@@ -53,7 +54,8 @@ gdb_test "up" ".*main.*" "up from marker1"
 set re_class	"((struct|class) foo \{${ws}public:|struct foo \{)"
 set re_fields	"int ifoo;${ws}const char ?\\* ?ccpfoo;"
 set XX_fields  	"int ifoo;${ws}char ?\\* ?ccpfoo;"
-set re_ctor	"foo\\(int\\);${ws}foo\\(int, (char const|const char) ?\\*\\);${ws}foo\\(foo ?&\\);"
+set re_ctor	"foo\\(int\\);${ws}foo\\(int, (char const|const char) ?\\*\\);\
+                 ${ws}foo\\(foo ?&\\);${ws}foo\\(foo ?&?&\\);"
 set re_dtor	"~foo\\((void|)\\);"
 set XX_dtor	"~foo\\(int\\);"
 set re_methods	                  "void foofunc\\(int\\);"
@@ -72,6 +74,8 @@ set re_methods	"${re_methods}${ws}int overload1arg\\(float\\);"
 set re_methods	"${re_methods}${ws}int overload1arg\\(double\\);"
 set re_methods	"${re_methods}${ws}int overload1arg\\(int \\*\\);"
 set re_methods	"${re_methods}${ws}int overload1arg\\(void \\*\\);"
+append re_methods "${ws}int overload1arg\\(foo &\\);"
+append re_methods "${ws}int overload1arg\\(foo &&\\);"
 set re_methods	"${re_methods}${ws}int overloadfnarg\\((void|)\\);"
 set re_methods	"${re_methods}${ws}int overloadfnarg\\(int\\);"
 set re_methods	"${re_methods}${ws}int overloadfnarg\\(int, int ?\\(\\*\\) ?\\(int\\)\\);"
@@ -254,6 +258,14 @@ gdb_test "print foo_instance1.overload1arg(&arg14)" \
     "\\$\[0-9\]+ = 14" \
     "print call overloaded func char\\* arg"
 
+gdb_test "print foo_instance1.overload1arg(arg15)" \
+    "\\$\[0-9\]+ = 15" \
+    "print call overloaded func foo & arg"
+
+gdb_test "print foo_instance1.overload1arg(static_cast<foo&&>(arg15))" \
+    "\\$\[0-9\]+ = 16" \
+    "print call overloaded func foo && arg"
+
 gdb_test "print bar(a)" "= 11"
 gdb_test "print bar(b)" "= 22"
 gdb_test "print bar(c)" "= 22"
diff --git a/gdb/testsuite/gdb.cp/ref-params.cc b/gdb/testsuite/gdb.cp/ref-params.cc
index 0f7e125..eb46a99 100644
--- a/gdb/testsuite/gdb.cp/ref-params.cc
+++ b/gdb/testsuite/gdb.cp/ref-params.cc
@@ -17,6 +17,8 @@
 
 /* Author: Paul N. Hilfinger, AdaCore Inc. */
 
+#include <utility>
+
 struct Parent {
   Parent (int id0) : id(id0) { }
   int id;
@@ -31,11 +33,21 @@ int f1(Parent& R)
   return R.id;			/* Set breakpoint marker3 here.  */
 }
 
+int f1(Parent&& R)
+{
+  return R.id;			/* Set breakpoint marker5 here.  */
+}
+
 int f2(Child& C)
 {
   return f1(C);			/* Set breakpoint marker2 here.  */
 }
 
+int f2(Child&& C)
+{
+  return f1(std::move(C));                 /* Set breakpoint marker4 here.  */
+}
+
 struct OtherParent {
   OtherParent (int other_id0) : other_id(other_id0) { }
   int other_id;
@@ -50,11 +62,21 @@ int mf1(OtherParent& R)
   return R.other_id;
 }
 
+int mf1(OtherParent&& R)
+{
+  return R.other_id;
+}
+
 int mf2(MultiChild& C)
 {
   return mf1(C);
 }
 
+int mf2(MultiChild&& C)
+{
+  return mf1(C);
+}
+
 int main(void) 
 {
   Child Q(42);
@@ -62,8 +84,13 @@ int main(void)
 
   /* Set breakpoint marker1 here.  */
 
+  f1(Q);
+  f1(QR);
+  f1(Child(42));
+
   f2(Q);
   f2(QR);
+  f2(Child(42));
 
   MultiChild MQ(53);
   MultiChild& MQR = MQ;
diff --git a/gdb/testsuite/gdb.cp/ref-params.exp b/gdb/testsuite/gdb.cp/ref-params.exp
index 4531602..ce943b8 100644
--- a/gdb/testsuite/gdb.cp/ref-params.exp
+++ b/gdb/testsuite/gdb.cp/ref-params.exp
@@ -24,7 +24,8 @@ if { [skip_cplus_tests] } { continue }
 
 standard_testfile .cc
 
-if {[build_executable $testfile.exp $testfile $srcfile {debug c++}] == 1} {
+if {[build_executable $testfile.exp $testfile $srcfile \
+    {debug c++ additional_flags="-std=c++11"}] == 1} {
     return -1
 }
 
@@ -48,15 +49,28 @@ gdb_start_again "marker1 here"
 gdb_test "print f1(QR)" ".* = 42.*" "print value of f1 on (Child&) in main"
 
 gdb_start_again "marker1 here"
+gdb_test "print f1(static_cast<Child&&>(Q))" ".* = 42.*" "print value of f1 on (Child&&) in main"
+
+gdb_start_again "marker1 here"
 gdb_test "print f2(QR)" ".* = 42.*" "print value of f2 on (Child&) in main"
 
+gdb_start_again "marker1 here"
+gdb_test "print f2(static_cast<Child&&>(Q))" ".* = 42.*" "print value of f2 on (Child&&) in main"
+
 gdb_start_again "marker2 here"
 gdb_test "print C" ".*id = 42.*" "print value of Child& in f2"
 gdb_test "print f1(C)" ".* = 42.*" "print value of f1 on Child& in f2"
 
+gdb_start_again "marker4 here"
+gdb_test "print C" ".*id = 42.*" "print value of Child&& in f2"
+gdb_test "print f1(C)" ".* = 42.*" "print value of f1 on Child&& in f2"
+
 gdb_start_again "marker3 here"
 gdb_test "print R" ".*id = 42.*" "print value of Parent& in f1"
 
+gdb_start_again "marker5 here"
+gdb_test "print R" ".*id = 42.*" "print value of Parent&& in f1"
+
 gdb_start_again "breakpoint MQ here"
 gdb_test "print f1(MQ)" ".* = 53"
 gdb_test "print mf1(MQ)" ".* = 106"
@@ -64,3 +78,8 @@ gdb_test "print mf2(MQ)" ".* = 106"
 gdb_test "print f1(MQR)" ".* = 53"
 gdb_test "print mf1(MQR)" ".* = 106"
 gdb_test "print mf2(MQR)" ".* = 106"
+gdb_test "print f1(static_cast<MultiChild&&>(MQ))" ".* = 53"
+gdb_start_again "breakpoint MQ here"
+gdb_test "print mf1(static_cast<MultiChild&&>(MQ))" ".* = 106"
+gdb_start_again "breakpoint MQ here"
+gdb_test "print mf2(static_cast<MultiChild&&>(MQ))" ".* = 106"
diff --git a/gdb/testsuite/gdb.cp/ref-types.cc b/gdb/testsuite/gdb.cp/ref-types.cc
index 2c124a9..dafec19 100644
--- a/gdb/testsuite/gdb.cp/ref-types.cc
+++ b/gdb/testsuite/gdb.cp/ref-types.cc
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include <utility>
+
 int main2(void);
 
 void marker1 (void)
@@ -39,6 +41,18 @@ int main(void)
     as[2] = 2;
     as[3] = 3;
 
+    short t = -1;
+    short *pt;
+    short &&rrt = std::move(t);
+    pt = &rrt;
+    short *&&rrpt = std::move(pt);
+    short at[4];
+    at[0] = 0;
+    at[1] = 1;
+    at[2] = 2;
+    at[3] = 3;
+    short (&&rrat)[4] = std::move(at);
+
     marker1();
 
     main2();
@@ -66,15 +80,25 @@ int main2(void)
     float F;
     double D;
     char &rC = C;
+    char &&rrC = 'A';
     unsigned char &rUC = UC;
+    unsigned char &&rrUC = 21;
     short &rS = S;
+    short &&rrS = -14;
     unsigned short &rUS = US;
+    unsigned short &&rrUS = 7;
     int &rI = I;
+    int &&rrI = 102;
     unsigned int &rUI = UI;
+    unsigned int &&rrUI = 1002;
     long &rL = L;
+    long &&rrL = -234;
     unsigned long &rUL = UL;
+    unsigned long &&rrUL = 234;
     float &rF = F;
+    float &&rrF = 1.25E10;
     double &rD = D;
+    double &&rrD = -1.375E-123;
     C = 'A';
     UC = 21;
     S = -14;
diff --git a/gdb/testsuite/gdb.cp/ref-types.exp b/gdb/testsuite/gdb.cp/ref-types.exp
index 3b557f9..fbaafc1 100644
--- a/gdb/testsuite/gdb.cp/ref-types.exp
+++ b/gdb/testsuite/gdb.cp/ref-types.exp
@@ -24,7 +24,8 @@ if { [skip_cplus_tests] } { continue }
 
 standard_testfile .cc
 
-if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
+if {[prepare_for_testing $testfile.exp $testfile $srcfile \
+    {debug c++ additional_flags="-std=c++11"}]} {
     return -1
 }
 
@@ -127,6 +128,35 @@ gdb_test "print ras\[1\]" ".\[0-9\]* = 1" "print value of ras\[1\]"
 gdb_test "print ras\[2\]" ".\[0-9\]* = 2" "print value of ras\[2\]"
 gdb_test "print ras\[3\]" ".\[0-9\]* = 3" "print value of ras\[3\]"
 
+# rvalue reference tests
+
+gdb_test_multiple "print rrt" "print value of rrt" {
+    -re ".\[0-9\]* = \\(short( int)? &&\\) @$hex: -1.*$gdb_prompt $" {
+        pass "print value of rrt"
+    }
+    eof { fail "print rrt ($gdb dumped core) (fixme)" ; gdb_start_again ; }
+}
+
+gdb_test "ptype rrt" "type = short( int)? &&.*$gdb_prompt $" "ptype rrt"
+
+gdb_test "print *rrpt" ".$decimal = -1" "print value of *rrpt"
+
+# gdb had a bug about dereferencing a pointer type
+# that would lead to wrong results
+# if we try to examine memory at pointer value.
+
+gdb_test "x /hd rrpt" "$hex:\[ \t\]*-1" "examine value at rrpt"
+
+gdb_test "ptype rrpt" "type = short( int)? \\*&&.*$gdb_prompt $" "ptype rrpt"
+
+gdb_test "print rrat\[0\]" ".$decimal = 0" "print value of rrat\[0\]"
+
+gdb_test "ptype rrat" "type = short( int)? \\\(&&\\\)\\\[4\\\].*$gdb_prompt $" "ptype rrat" {
+
+gdb_test "print rrat\[1\]" ".$decimal = 1" "print value of rrat\[1\]"
+gdb_test "print rrat\[2\]" ".$decimal = 2" "print value of rrat\[2\]"
+gdb_test "print rrat\[3\]" ".$decimal = 3" "print value of rrat\[3\]"
+
 
 if ![runto 'f'] then {
     perror "couldn't run to f"
@@ -270,3 +300,63 @@ gdb_test "print rD" \
     ".\[0-9\]* = \\(double &\\) @$hex: -1.375e-123.*" \
     "print value of rD"
 
+#
+# test rvalue reference types
+#
+
+gdb_test "ptype rrC" "type = char &&"
+
+gdb_test "ptype rrUC" "type = unsigned char &&"
+
+gdb_test "ptype rrS" "type = short( int)? &&" "ptype rrS"
+
+gdb_test "ptype rrUS" "type = unsigned short( int)? &&" "ptype rrUS"
+
+gdb_test "ptype rrI" "type = int &&"
+
+gdb_test "ptype rrUI" "type = unsigned int &&"
+
+gdb_test "ptype rrL" "type = long( int)? &&" "ptype rrL"
+
+gdb_test "ptype rrUL" "type = unsigned long( int)? &&" "ptype rrUL"
+
+gdb_test "ptype rrF" "type = float &&"
+
+gdb_test "ptype rrD" "type = double &&"
+
+gdb_test "print rrC" "$decimal = \\(char &&\\) @$hex: 65 \'A\'" \
+    "print value of rrC"
+
+gdb_test "print rrUC" \
+    "$decimal = \\(unsigned char &&\\) @$hex: 21 \'.025\'" \
+    "print value of rrUC"
+
+gdb_test "print rrS" "$decimal = \\(short( int)? &&\\) @$hex: -14" \
+                  "print value of rrS"
+
+gdb_test "print rrUS" \
+         "$decimal = \\(unsigned short( int)? &&\\) @$hex: 7" \
+         "print value of rrUS"
+
+gdb_test "print rrI" "$decimal = \\(int &&\\) @$hex: 102" \
+       "print value of rrI"
+
+gdb_test "print rrUI" \
+    "$decimal = \\(unsigned int &&\\) @$hex: 1002" \
+        "print value of rrUI"
+
+gdb_test "print rrL" \
+       "$decimal = \\(long( int)? &&\\) @$hex: -234" \
+         "print value of rrL"
+
+gdb_test "print rrUL" \
+    "$decimal = \\((unsigned long|long unsigned int)? &&\\) @$hex: 234" \
+    "print value of rrUL"
+
+gdb_test "print rrF" \
+    "$decimal = \\(float &&\\) @$hex: 1.2${decimal}e\\+0?10.*" \
+    "print value of rrF"
+
+gdb_test "print rrD" \
+    "$decimal = \\(double &&\\) @$hex: -1.375e-123.*" \
+    "print value of rrD"
diff --git a/gdb/testsuite/gdb.python/py-value-cc.cc b/gdb/testsuite/gdb.python/py-value-cc.cc
index de819d7..188c4fa 100644
--- a/gdb/testsuite/gdb.python/py-value-cc.cc
+++ b/gdb/testsuite/gdb.python/py-value-cc.cc
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include <utility>
+
 class A {
  public:
   int operator+ (const int a1);
@@ -60,8 +62,10 @@ func (const A &a)
 {
   int val = 10;
   int &int_ref = val;
+  int &&int_rref = std::move(val);
   int_ptr ptr = &val;
   int_ptr &int_ptr_ref = ptr;
+  int_ptr &&int_ptr_rref = std::move(ptr);
 
   B b;
   B b1;
diff --git a/gdb/testsuite/gdb.python/py-value-cc.exp b/gdb/testsuite/gdb.python/py-value-cc.exp
index d7c5e0b..1e48ab6 100644
--- a/gdb/testsuite/gdb.python/py-value-cc.exp
+++ b/gdb/testsuite/gdb.python/py-value-cc.exp
@@ -20,7 +20,8 @@ if { [skip_cplus_tests] } { continue }
 
 standard_testfile .cc
 
-if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
+if {[prepare_for_testing $testfile.exp $testfile $srcfile \
+    {debug c++ additional_flags="-std=c++11"}]} {
     return -1
 }
 
@@ -39,11 +40,18 @@ gdb_test "python print (str(gdb.parse_and_eval(\"a\").referenced_value().type))"
 gdb_test "python print (str(gdb.parse_and_eval(\"int_ref\").type))" "int &"
 gdb_test "python print (str(gdb.parse_and_eval(\"int_ref\").referenced_value().type))" "int"
 gdb_test "python print (str(gdb.parse_and_eval(\"int_ref\").referenced_value()))" "10"
+gdb_test "python print (str(gdb.parse_and_eval(\"int_rref\").type))" "int &&"
+gdb_test "python print (str(gdb.parse_and_eval(\"int_rref\").referenced_value().type))" "int"
+gdb_test "python print (str(gdb.parse_and_eval(\"int_rref\").referenced_value()))" "10"
 
 gdb_test "python print (str(gdb.parse_and_eval(\"int_ptr_ref\").dereference().type))" "int"
 gdb_test "python print (str(gdb.parse_and_eval(\"int_ptr_ref\").referenced_value().type))" "int_ptr"
 gdb_test "python print (str(gdb.parse_and_eval(\"int_ptr_ref\").referenced_value().dereference()))" "10"
 gdb_test "python print (str(gdb.parse_and_eval(\"int_ptr_ref\").referenced_value().referenced_value()))" "10"
+gdb_test "python print (str(gdb.parse_and_eval(\"int_ptr_rref\").dereference().type))" "int"
+gdb_test "python print (str(gdb.parse_and_eval(\"int_ptr_rref\").referenced_value().type))" "int_ptr"
+gdb_test "python print (str(gdb.parse_and_eval(\"int_ptr_rref\").referenced_value().dereference()))" "10"
+gdb_test "python print (str(gdb.parse_and_eval(\"int_ptr_rref\").referenced_value().referenced_value()))" "10"
 
 # Tests for gdb.Value[gdb.Field]
 gdb_test_no_output "python b = gdb.parse_and_eval('b')" "init b"
