diff mbox

[11/11,PR,gdb/14441] gdb: testsuite: add rvalue reference tests

Message ID 1450661481-31178-12-git-send-email-artemiyv@acm.org
State New
Headers show

Commit Message

Artemiy Volkov Dec. 21, 2015, 1:31 a.m. UTC
This patch adds tests for the initial rvalue reference support patchset.
Files to change were selected among the most important files which test
regular C++ references and the added tests are practically mirrored regular
references tests. Tested are printing of rvalue reference types and values,
rvalue reference parameters in function overloading, demangling of function
names containing rvalue reference parameters, casts to rvalue reference types,
and application of the sizeof operator to rvalue reference types and values.

All the changed files have been obviously set to compile with -std=c++11,
and in some cases this required altering function names which coincided
with keywords introduced in the new standard.

testsuite/ChangeLog:

2015-12-20  Artemiy Volkov  <artemiyv@acm.org>

        * gdb.cp/casts.cc (main): Change decltype() function name. Add
        rvalue reference type variables.
        * gdb.cp/casts.exp: Compile with -std=c++11. Add rvalue reference
        cast tests.
        * gdb.cp/cpsizeof.cc: Add rvalue reference type variables.
        * gdb.cp/cpsizeof.exp: Compile with -std=c++11. Add rvalue
        reference sizeof tests.
        * gdb.cp/demangle.exp: Add rvalue reference demangle tests.
        * gdb.cp/overload.cc (int main): Add a ctor and some methods
        with rvalue reference parameters.
        * gdb.cp/overload.exp: Compile with -std=c++11. Add rvalue
        reference overloading tests.
        * gdb.cp/ref-params.cc (int f1): New function taking rvalue
        reference parameter.
        (int f2): Likewise.
        (int mf1): Likewise.
        (int mf2): Likewise.
        * gdb.cp/ref-params.exp: Compile with -std=c++11. Add rvalue
        reference parameter printing tests.
        * gdb.cp/ref-types.cc (int main2): Add rvalue reference type
        variables.
        * gdb.cp/ref-types.exp: Compile with -std=c++11. Add rvalue
        reference type printing tests.
---
 gdb/testsuite/gdb.cp/casts.cc       |   8 +-
 gdb/testsuite/gdb.cp/casts.exp      |  34 ++++++-
 gdb/testsuite/gdb.cp/cpsizeof.cc    |   4 +
 gdb/testsuite/gdb.cp/cpsizeof.exp   |   2 +-
 gdb/testsuite/gdb.cp/demangle.exp   | 172 +++++++++++++++++++++++++++++++++++-
 gdb/testsuite/gdb.cp/overload.cc    |   9 ++
 gdb/testsuite/gdb.cp/overload.exp   |  14 ++-
 gdb/testsuite/gdb.cp/ref-params.cc  |  29 +++++-
 gdb/testsuite/gdb.cp/ref-params.exp |  20 ++++-
 gdb/testsuite/gdb.cp/ref-types.cc   |  24 +++++
 gdb/testsuite/gdb.cp/ref-types.exp  | 136 +++++++++++++++++++++++++++-
 11 files changed, 439 insertions(+), 13 deletions(-)
diff mbox

Patch

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 c202cb2..556b7c0 100644
--- a/gdb/testsuite/gdb.cp/casts.exp
+++ b/gdb/testsuite/gdb.cp/casts.exp
@@ -33,7 +33,7 @@  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 +86,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 +113,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 +125,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 +145,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 +171,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 +191,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 cac9397..d44d002 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 37bc440..ac0e5e1 100644
--- a/gdb/testsuite/gdb.cp/cpsizeof.exp
+++ b/gdb/testsuite/gdb.cp/cpsizeof.exp
@@ -18,7 +18,7 @@  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 078f4b4..8c0e1ba 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: ArrowheadIntersects__9ArrowLineP9ArrowheadO6BoxObjP7Graphic" "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: BitPatterntoa__FOC10BitPatternccc" \
+	"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: CoreConstDecls__8TextCodeO7ostream" "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: DrawDestinationTransformedImage__FP7_XImageiiT0iiUlUiiiUiUlUlP4_XGCOC13ivTransformeriiii" \
+	"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: Effect__11RelateManipO7ivEvent" "RelateManip::Effect(ivEvent &&)"
     test_demangling "gnu: FilterName__FPCc" \
 	"FilterName\[(\]+(const char|char const) \[*\]+\[)\]+"
     test_demangling "gnu: Filter__6PSTextPCci" \
@@ -144,10 +151,13 @@  proc test_gnu_style_demangling {} {
     test_demangling "gnu: FindColor__7CatalogPCciii" \
 	"Catalog::FindColor\[(\]+(const char|char const) \[*\]+, int, int, int\[)\]+"
     test_demangling_exact "gnu: FindFixed__FRP4CNetP4CNet" "FindFixed(CNet *&, CNet *)"
+    test_demangling_exact "gnu: FindFixed__FOP4CNetP4CNet" "FindFixed(CNet *&&, CNet *)"
     test_demangling "gnu: FindFont__7CatalogPCcN21" \
 	"Catalog::FindFont\[(\]+(const char|char const) \[*\]+, (const char|char const) \[*\]+, (const char|char const) \[*\]+\[)\]+"
     test_demangling_exact "gnu: Fix48_abort__FR8twolongs" "Fix48_abort(twolongs &)"
+    test_demangling_exact "gnu: Fix48_abort__FO8twolongs" "Fix48_abort(twolongs &&)"
     test_demangling_exact "gnu: GetBarInfo__15iv2_6_VScrollerP13ivPerspectiveRiT2" "iv2_6_VScroller::GetBarInfo(ivPerspective *, int &, int &)"
+    test_demangling_exact "gnu: GetBarInfo__15iv2_6_VScrollerP13ivPerspectiveOiT2" "iv2_6_VScroller::GetBarInfo(ivPerspective *, int &&, int &&)"
     test_demangling_exact "gnu: GetBgColor__C9ivPainter" "ivPainter::GetBgColor(void) const"
 
     test_demangling "gnu: Iisdouble__FPC6IntRep" \
@@ -159,10 +169,13 @@  proc test_gnu_style_demangling {} {
     test_demangling_exact "gnu: InsertToplevel__7ivWorldP12ivInteractorT1iiUi" "ivWorld::InsertToplevel(ivInteractor *, ivInteractor *, int, int, unsigned int)"
     test_demangling "gnu: IsADirectory__FPCcR4stat" \
 	"IsADirectory\[(\]+(const char|char const) \[*\]+, stat &\[)\]+"
+    test_demangling "gnu: IsADirectory__FPCcO4stat" \
+	"IsADirectory\[(\]+(const char|char const) \[*\]+, stat &&\[)\]+"
     test_demangling_exact "gnu: IsAGroup__FP11GraphicViewP11GraphicComp" "IsAGroup(GraphicView *, GraphicComp *)"
     test_demangling_exact "gnu: IsA__10ButtonCodeUl" "ButtonCode::IsA(unsigned long)"
 
     test_demangling_exact "gnu: ReadName__FR7istreamPc" "ReadName(istream &, char *)"
+    test_demangling_exact "gnu: ReadName__FO7istreamPc" "ReadName(istream &&, char *)"
     test_demangling_exact "gnu: Redraw__13StringBrowseriiii" "StringBrowser::Redraw(int, int, int, int)"
     test_demangling_exact "gnu: Rotate__13ivTransformerf" "ivTransformer::Rotate(float)"
     test_demangling_exact "gnu: Rotated__C13ivTransformerf" "ivTransformer::Rotated(float) const"
@@ -173,10 +186,15 @@  proc test_gnu_style_demangling {} {
     test_demangling_exact "gnu: Set__5DFacePcii" "DFace::Set(char *, int, int)"
 
     test_demangling_exact "gnu: VConvert__9ivTSolverP12ivInteractorRP8TElementT2" "ivTSolver::VConvert(ivInteractor *, TElement *&, TElement *&)"
+    test_demangling_exact "gnu: VConvert__9ivTSolverP12ivInteractorOP8TElementT2" "ivTSolver::VConvert(ivInteractor *, TElement *&&, TElement *&&)"
     test_demangling_exact "gnu: VConvert__9ivTSolverP7ivTGlueRP8TElement" "ivTSolver::VConvert(ivTGlue *, TElement *&)"
+    test_demangling_exact "gnu: VConvert__9ivTSolverP7ivTGlueOP8TElement" "ivTSolver::VConvert(ivTGlue *, TElement *&&)"
     test_demangling_exact "gnu: VOrder__9ivTSolverUiRP12ivInteractorT2" "ivTSolver::VOrder(unsigned int, ivInteractor *&, ivInteractor *&)"
+    test_demangling_exact "gnu: VOrder__9ivTSolverUiOP12ivInteractorT2" "ivTSolver::VOrder(unsigned int, ivInteractor *&&, ivInteractor *&&)"
     test_demangling "gnu: Valid__7CatalogPCcRP4Tool" \
 	"Catalog::Valid\[(\]+(const char|char const) \[*\]+, Tool \[*\]+&\[)\]+"
+    test_demangling "gnu: Valid__7CatalogPCcOP4Tool" \
+	"Catalog::Valid\[(\]+(const char|char const) \[*\]+, Tool \[*\]+&&\[)\]+"
     test_demangling_exact "gnu: _10PageButton\$__both" "PageButton::__both"
     test_demangling_exact "gnu: _3RNG\$singleMantissa" "RNG::singleMantissa"
     test_demangling_exact "gnu: _5IComp\$_release" "IComp::_release"
@@ -206,16 +224,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: __20DisplayList_IteratorO11DisplayList" "DisplayList_Iterator::DisplayList_Iterator(DisplayList &&)"
     test_demangling_exact "gnu: __3fooRT0" "foo::foo(foo &)"
+    test_demangling_exact "gnu: __3fooOT0" "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: __3fooiOT0iT2iT2" "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: __7ivWorldPCcOiPPcPC12ivOptionDescPC14ivPropertyData" \
+	"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)"
@@ -265,10 +288,16 @@  proc test_gnu_style_demangling {} {
     test_demangling_exact "gnu: __ne__3fooRT0" "foo::operator!=(foo &)"
     test_demangling "gnu: __ne__FRC7ComplexT0" \
 	"operator!=\[(\]+(const Complex|Complex const) &, (const Complex|Complex const) &\[)\]+"
+    test_demangling "gnu: __ne__FOC7ComplexT0" \
+	"operator!=\[(\]+(const Complex|Complex const) &&, (const Complex|Complex const) &&\[)\]+"
     test_demangling "gnu: __ne__FRC7Complexd" \
 	"operator!=\[(\]+(const Complex|Complex const) &, double\[)\]+"
+    test_demangling "gnu: __ne__FOC7Complexd" \
+	"operator!=\[(\]+(const Complex|Complex const) &&, double\[)\]+"
     test_demangling "gnu: __ne__FRC9SubStringRC6String" \
 	"operator!=\[(\]+(const SubString|SubString const) &, (const String|String const) &\[)\]+"
+    test_demangling "gnu: __ne__FOC9SubStringOC6String" \
+	"operator!=\[(\]+(const SubString|SubString const) &&, (const String|String const) &&\[)\]+"
     test_demangling_exact "gnu: __nt__3foo" "foo::operator!(void)"
     test_demangling_exact "gnu: __nw__3fooi" "foo::operator new(int)"
     test_demangling_exact "gnu: __oo__3fooRT0" "foo::operator||(foo &)"
@@ -283,6 +312,8 @@  proc test_gnu_style_demangling {} {
     test_demangling "gnu: __vc__3fooRT0" "foo::operator\\\[\\\]\\(foo &\\)"
     test_demangling "gnu: _gsub__6StringRC5RegexPCci" \
 	"String::_gsub\[(\]+(const Regex|Regex const) &, (const char|char const) \[*\]+, int\[)\]+"
+    test_demangling "gnu: _gsub__6StringOC5RegexPCci" \
+	"String::_gsub\[(\]+(const Regex|Regex const) &&, (const char|char const) \[*\]+, int\[)\]+"
     test_demangling_exact "gnu: _new_Fix__FUs" "_new_Fix(unsigned short)"
 
     # gcc 2.4.5 (and earlier) style virtual tables.  We want to continue to
@@ -295,6 +326,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: arg__FOC7Complex" \
+	"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,35 +338,55 @@  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: contains__C9BitStringOC10BitPattern" \
+	"BitString::contains\[(\]+(const BitPattern|BitPattern const) &&\[)\]+ const"
     test_demangling "gnu: contains__C9BitStringRC12BitSubStringi" \
 	"BitString::contains\[(\]+(const BitSubString|BitSubString const) &, int\[)\]+ const"
+    test_demangling "gnu: contains__C9BitStringOC12BitSubStringi" \
+	"BitString::contains\[(\]+(const BitSubString|BitSubString const) &&, int\[)\]+ const"
     test_demangling "gnu: contains__C9BitStringRT0" \
 	"BitString::contains\[(\]+(const BitString|BitString const) &\[)\]+ const"
+    test_demangling "gnu: contains__C9BitStringOT0" \
+	"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" \
 	"div\[(\]+(const IntRep|IntRep const) \[*\]+, long, IntRep \[*\]+\[)\]+"
     test_demangling "gnu: div__FRC8RationalT0R8Rational" \
 	"div\[(\]+(const Rational|Rational const) &, (const Rational|Rational const) &, Rational &\[)\]+"
+    test_demangling "gnu: div__FOC8RationalT0O8Rational" \
+	"div\[(\]+(const Rational|Rational const) &&, (const Rational|Rational const) &&, Rational &&\[)\]+"
     test_demangling "gnu: divide__FRC7IntegerT0R7IntegerT2" \
 	"divide\[(\]+(const Integer|Integer const) &, (const Integer|Integer const) &, Integer &, Integer &\[)\]+"
+    test_demangling "gnu: divide__FOC7IntegerT0O7IntegerT2" \
+	"divide\[(\]+(const Integer|Integer const) &&, (const Integer|Integer const) &&, Integer &&, Integer &&\[)\]+"
     test_demangling "gnu: divide__FRC7IntegerlR7IntegerRl" \
 	"divide\[(\]+(const Integer|Integer const) &, long, Integer &, long &\[)\]+"
+    test_demangling "gnu: divide__FOC7IntegerlO7IntegerOl" \
+	"divide\[(\]+(const Integer|Integer const) &&, long, Integer &&, long &&\[)\]+"
     test_demangling "gnu: enable__14DocumentViewerPCcUi" \
 	"DocumentViewer::enable\[(\]+(const char|char const) \[*\]+, unsigned int\[)\]+"
 
     test_demangling_exact "gnu: foo__FiN30" "foo(int, int, int, int)"
     test_demangling_exact "gnu: foo__FiR3fooiT1iT1" "foo(int, foo &, int, foo &, int, foo &)"
+    test_demangling_exact "gnu: foo__FiO3fooiT1iT1" "foo(int, foo &&, int, foo &&, int, foo &&)"
     test_demangling_exact "gnu: foo___3barl" "bar::foo_(long)"
     test_demangling_exact "gnu: insert__15ivClippingStacklRP8_XRegion" "ivClippingStack::insert(long, _XRegion *&)"
+    test_demangling_exact "gnu: insert__15ivClippingStacklOP8_XRegion" "ivClippingStack::insert(long, _XRegion *&&)"
     test_demangling_exact "gnu: insert__16ChooserInfo_ListlR11ChooserInfo" "ChooserInfo_List::insert(long, ChooserInfo &)"
+    test_demangling_exact "gnu: insert__16ChooserInfo_ListlO11ChooserInfo" "ChooserInfo_List::insert(long, ChooserInfo &&)"
     test_demangling_exact "gnu: insert__17FontFamilyRepListlRP15ivFontFamilyRep" "FontFamilyRepList::insert(long, ivFontFamilyRep *&)"
+    test_demangling_exact "gnu: insert__17FontFamilyRepListlOP15ivFontFamilyRep" "FontFamilyRepList::insert(long, ivFontFamilyRep *&&)"
     test_demangling_exact "gnu: leaveok__FP7_win_stc" "leaveok(_win_st *, char)"
     test_demangling_exact "gnu: left_mover__C7ivMFKitP12ivAdjustableP7ivStyle" "ivMFKit::left_mover(ivAdjustable *, ivStyle *) const"
     test_demangling "gnu: matches__C9BitStringRC10BitPatterni" \
 	"BitString::matches\[(\]+(const BitPattern|BitPattern const) &, int\[)\]+ const"
+    test_demangling "gnu: matches__C9BitStringOC10BitPatterni" \
+	"BitString::matches\[(\]+(const BitPattern|BitPattern const) &&, int\[)\]+ const"
     test_demangling "gnu: matches__C9SubStringRC5Regex" \
 	"SubString::matches\[(\]+(const Regex|Regex const) &\[)\]+ const"
+    test_demangling "gnu: matches__C9SubStringOC5Regex" \
+	"SubString::matches\[(\]+(const Regex|Regex const) &&\[)\]+ const"
 
     test_demangling_exact "gnu: overload1arg__FSc" "overload1arg(signed char)"
     test_demangling_exact "gnu: overload1arg__FUc" "overload1arg(unsigned char)"
@@ -361,12 +414,18 @@  proc test_gnu_style_demangling {} {
     test_demangling_exact "gnu: overloadargs__Fiiiiiiiiiii" "overloadargs(int, int, int, int, int, int, int, int, int, int, int)"
     test_demangling "gnu: pick__13ivCompositionP8ivCanvasRC12ivAllocationiR5ivHit" \
 	"ivComposition::pick\[(\]+ivCanvas \[*\]+, (const ivAllocation|ivAllocation const) &, int, ivHit &\[)\]+"
+    test_demangling "gnu: pick__13ivCompositionP8ivCanvasOC12ivAllocationiO5ivHit" \
+	"ivComposition::pick\[(\]+ivCanvas \[*\]+, (const ivAllocation|ivAllocation const) &&, int, ivHit &&\[)\]+"
     test_demangling "gnu: pointer__C11ivHScrollerRC7ivEventRC12ivAllocation" \
 	"ivHScroller::pointer\[(\]+(const ivEvent|ivEvent const) &, (const ivAllocation|ivAllocation const) &\[)\]+ const"
+    test_demangling "gnu: pointer__C11ivHScrollerOC7ivEventOC12ivAllocation" \
+	"ivHScroller::pointer\[(\]+(const ivEvent|ivEvent const) &&, (const ivAllocation|ivAllocation const) &&\[)\]+ const"
     test_demangling_exact "gnu: poke__8ivRasterUlUlffff" "ivRaster::poke(unsigned long, unsigned long, float, float, float, float)"
     test_demangling_exact "gnu: polar__Fdd" "polar(double, double)"
     test_demangling "gnu: read__10osStdInputRPCc" \
 	"osStdInput::read\[(\]+(const char|char const) \[*\]+&\[)\]+"
+    test_demangling "gnu: read__10osStdInputOPCc" \
+	"osStdInput::read\[(\]+(const char|char const) \[*\]+&&\[)\]+"
 
     test_demangling_exact "gnu: scale__13ivTransformerff" "ivTransformer::scale(float, float)"
     test_demangling "gnu: scanw__12CursesWindowPCce" \
@@ -379,6 +438,8 @@  proc test_gnu_style_demangling {} {
     test_demangling_exact "gnu: test__C6BitSetii" "BitSet::test(int, int) const"
     test_demangling "gnu: testbit__FRC7Integerl" \
 	"testbit\[(\]+(const Integer|Integer const) &, long\[)\]+"
+    test_demangling "gnu: testbit__FOC7Integerl" \
+	"testbit\[(\]+(const Integer|Integer const) &&, long\[)\]+"
     test_demangling_exact "gnu: text_source__8Documentl" "Document::text_source(long)"
     test_demangling_exact "gnu: variance__6Erlangd" "Erlang::variance(double)"
     test_demangling "gnu: vform__8iostreamPCcPc" \
@@ -436,27 +497,41 @@  proc test_gnu_style_demangling {} {
 
     test_demangling_exact "gnu: __Q2t4List1Z10VHDLEntity3PixRCQ2t4List1Z10VHDLEntity3Pix" \
 	"List<VHDLEntity>::Pix::Pix(List<VHDLEntity>::Pix const &)"
+    test_demangling_exact "gnu: __Q2t4List1Z10VHDLEntity3PixOCQ2t4List1Z10VHDLEntity3Pix" \
+	"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: __Q2t4List1Z10VHDLEntity7elementOC10VHDLEntityPT0" \
+	"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: __Q2t4List1Z10VHDLEntity7elementOCQ2t4List1Z10VHDLEntity7element" \
+	"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: __cl__Ct4List1Z10VHDLEntityOCQ2t4List1Z10VHDLEntity3Pix" \
+	"List<VHDLEntity>::operator()(List<VHDLEntity>::Pix const &&) const"
 
     test_demangling_exact "gnu: __ne__FPvRCQ2t4List1Z10VHDLEntity3Pix" \
 	"operator!=(void *, List<VHDLEntity>::Pix const &)"
+    test_demangling_exact "gnu: __ne__FPvOCQ2t4List1Z10VHDLEntity3Pix" \
+	"operator!=(void *, List<VHDLEntity>::Pix const &&)"
 
     test_demangling_exact "gnu: __ne__FPvRCt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
 	"operator!=(void *, PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> > const &)"
+    test_demangling_exact "gnu: __ne__FPvOCt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
+	"operator!=(void *, PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> > const &&)"
 
     test_demangling_exact "gnu: __t4List1Z10VHDLEntityRCt4List1Z10VHDLEntity" \
 	"List<VHDLEntity>::List(List<VHDLEntity> const &)"
+    test_demangling_exact "gnu: __t4List1Z10VHDLEntityOCt4List1Z10VHDLEntity" \
+	"List<VHDLEntity>::List(List<VHDLEntity> const &&)"
 
     test_demangling_exact "gnu: __t4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
 	"PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >::PixX(void)"
@@ -465,13 +540,19 @@  proc test_gnu_style_demangling {} {
 	"PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >::PixX(VHDLLibraryRep *, List<VHDLEntity>::Pix)"
 
     test_demangling_exact "gnu: __t4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntityRCt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
-	"PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >::PixX(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> > const &)"
+       "PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >::PixX(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> > const &)"
+    test_demangling_exact "gnu: __t4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntityOCt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
+	"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: nextE__C11VHDLLibraryOt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
+	"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: next__Ct4List1Z10VHDLEntityOQ2t4List1Z10VHDLEntity3Pix" \
+	"List<VHDLEntity>::next(List<VHDLEntity>::Pix &&) const"
 
     test_demangling_exact "gnu: _GLOBAL_\$D\$set" "global destructors keyed to set"
 
@@ -479,41 +560,67 @@  proc test_gnu_style_demangling {} {
 
     test_demangling_exact "gnu: __as__t5ListS1ZUiRCt5ListS1ZUi" \
 	"ListS<unsigned int>::operator=(ListS<unsigned int> const &)"
+    test_demangling_exact "gnu: __as__t5ListS1ZUiOCt5ListS1ZUi" \
+	"ListS<unsigned int>::operator=(ListS<unsigned int> const &&)"
 
     test_demangling_exact "gnu: __cl__Ct5ListS1ZUiRCQ2t5ListS1ZUi3Vix" \
 	"ListS<unsigned int>::operator()(ListS<unsigned int>::Vix const &) const"
+    test_demangling_exact "gnu: __cl__Ct5ListS1ZUiOCQ2t5ListS1ZUi3Vix" \
+	"ListS<unsigned int>::operator()(ListS<unsigned int>::Vix const &&) const"
 
     test_demangling_exact "gnu: __cl__Ct5SetLS1ZUiRCQ2t5SetLS1ZUi3Vix" \
 	"SetLS<unsigned int>::operator()(SetLS<unsigned int>::Vix const &) const"
+    test_demangling_exact "gnu: __cl__Ct5SetLS1ZUiOCQ2t5SetLS1ZUi3Vix" \
+	"SetLS<unsigned int>::operator()(SetLS<unsigned int>::Vix const &&) const"
 
     test_demangling_exact "gnu: __t10ListS_link1ZUiRCUiPT0" \
 	"ListS_link<unsigned int>::ListS_link(unsigned int const &, ListS_link<unsigned int> *)"
+    test_demangling_exact "gnu: __t10ListS_link1ZUiOCUiPT0" \
+	"ListS_link<unsigned int>::ListS_link(unsigned int const &&, ListS_link<unsigned int> *)"
 
     test_demangling_exact "gnu: __t10ListS_link1ZUiRCt10ListS_link1ZUi" \
 	"ListS_link<unsigned int>::ListS_link(ListS_link<unsigned int> const &)"
+    test_demangling_exact "gnu: __t10ListS_link1ZUiOCt10ListS_link1ZUi" \
+	"ListS_link<unsigned int>::ListS_link(ListS_link<unsigned int> const &&)"
 
     test_demangling_exact "gnu: __t5ListS1ZUiRCt5ListS1ZUi" \
 	"ListS<unsigned int>::ListS(ListS<unsigned int> const &)"
+    test_demangling_exact "gnu: __t5ListS1ZUiOCt5ListS1ZUi" \
+	"ListS<unsigned int>::ListS(ListS<unsigned int> const &&)"
 
     test_demangling_exact "gnu: next__Ct5ListS1ZUiRQ2t5ListS1ZUi3Vix" \
 	"ListS<unsigned int>::next(ListS<unsigned int>::Vix &) const"
+    test_demangling_exact "gnu: next__Ct5ListS1ZUiOQ2t5ListS1ZUi3Vix" \
+	"ListS<unsigned int>::next(ListS<unsigned int>::Vix &&) const"
 
     test_demangling_exact "gnu: __ne__FPvRCQ2t5SetLS1ZUi3Vix" \
 	"operator!=(void *, SetLS<unsigned int>::Vix const &)"
+    test_demangling_exact "gnu: __ne__FPvOCQ2t5SetLS1ZUi3Vix" \
+	"operator!=(void *, SetLS<unsigned int>::Vix const &&)"
     test_demangling_exact "gnu: __t8ListElem1Z5LabelRt4List1Z5Label" \
 	"ListElem<Label>::ListElem(List<Label> &)"
+    test_demangling_exact "gnu: __t8ListElem1Z5LabelOt4List1Z5Label" \
+	"ListElem<Label>::ListElem(List<Label> &&)"
     test_demangling_exact "gnu: __t8BDDHookV1ZPcRCPc" \
 	"BDDHookV<char *>::BDDHookV(char *const &)"
+    test_demangling_exact "gnu: __t8BDDHookV1ZPcOCPc" \
+	"BDDHookV<char *>::BDDHookV(char *const &&)"
 
     test_demangling_exact "gnu: _vt\$t8BDDHookV1ZPc" "BDDHookV<char *> virtual table"
 
     test_demangling_exact "gnu: __ne__FPvRCQ211BDDFunction4VixB" \
 	"operator!=(void *, BDDFunction::VixB const &)"
+    test_demangling_exact "gnu: __ne__FPvOCQ211BDDFunction4VixB" \
+	"operator!=(void *, BDDFunction::VixB const &&)"
     test_demangling_exact "gnu: __eq__FPvRCQ211BDDFunction4VixB" \
 	"operator==(void *, BDDFunction::VixB const &)"
+    test_demangling_exact "gnu: __eq__FPvOCQ211BDDFunction4VixB" \
+	"operator==(void *, BDDFunction::VixB const &&)"
 
     test_demangling_exact "gnu: relativeId__CQ36T_phi210T_preserve8FPC_nextRCQ26T_phi210T_preserveRC10Parameters" \
 	 "T_phi2::T_preserve::FPC_next::relativeId(T_phi2::T_preserve const &, Parameters const &) const"
+    test_demangling_exact "gnu: relativeId__CQ36T_phi210T_preserve8FPC_nextOCQ26T_phi210T_preserveOC10Parameters" \
+	 "T_phi2::T_preserve::FPC_next::relativeId(T_phi2::T_preserve const &&, Parameters const &&) const"
 
     test_demangling_exact "gnu: _Utf390_1__1_9223372036854775807__9223372036854775" \
 	    "Can't demangle \"_Utf390_1__1_9223372036854775807__9223372036854775\""
@@ -535,6 +642,16 @@  proc test_gnu_style_demangling {} {
 	    pass "gnu: __thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlRPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingRPQ29CosNaming15BindingIterator"
 	}
     }
+
+    gdb_test_multiple "demangle __thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlOPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingOPQ29CosNaming15BindingIterator" "gnu: __thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlOPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingOPQ29CosNaming15BindingIterator" {
+	-re "virtual function thunk \\(delta:-64\\) for CosNaming::_proxy_NamingContext::_0RL__list\\(unsigned long, _CORBA_Unbounded_Sequence<CosNaming::Binding> \\*\\&\\&, CosNaming::BindingIterator \\*\\&\\&\\)\r\n$gdb_prompt $" {
+	    pass "gnu: __thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlOPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingOPQ29CosNaming15BindingIterator"
+	}
+	-re ".*Can't demangle \"__thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlOPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingOPQ29CosNaming15BindingIterator\"\r\n$gdb_prompt $" {
+	    pass "gnu: __thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlOPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingOPQ29CosNaming15BindingIterator"
+	}
+    }
+
 }
 
 #
@@ -570,12 +687,15 @@  proc test_lucid_style_demangling {} {
     test_demangling_exact "lucid: __ct__10ostrstreamFPciT2" "ostrstream::ostrstream(char *, int, int)"
     test_demangling_exact "lucid: __ct__10ostrstreamFv" "ostrstream::ostrstream(void)"
     test_demangling_exact "lucid: __ct__10smanip_intFPFR3iosi_R3iosi" "smanip_int::smanip_int(ios &(*)(ios &, int), int)"
+    test_demangling_exact "lucid: __ct__10smanip_intFPFO3iosi_O3iosi" "smanip_int::smanip_int(ios &&(*)(ios &&, int), int)"
     test_demangling "lucid: __ct__11c_exceptionFPcRC7complexT2" "c_exception::c_exception\[(\]+char \[*\]+, (const complex|complex const) &, (const complex|complex const) &\[)\]+"
+    test_demangling "lucid: __ct__11c_exceptionFPcOC7complexT2" "c_exception::c_exception\[(\]+char \[*\]+, (const complex|complex const) &&, (const complex|complex const) &&\[)\]+"
     test_demangling "lucid: __ct__11fstreambaseFPCciT2" "fstreambase::fstreambase\[(\]+(const char|char const) \[*\]+, int, int\[)\]+"
     test_demangling_exact "lucid: __ct__11fstreambaseFi" "fstreambase::fstreambase(int)"
     test_demangling_exact "lucid: __ct__11fstreambaseFiPcT1" "fstreambase::fstreambase(int, char *, int)"
     test_demangling_exact "lucid: __ct__11fstreambaseFv" "fstreambase::fstreambase(void)"
     test_demangling_exact "lucid: __ct__11smanip_longFPFR3iosl_R3iosl" "smanip_long::smanip_long(ios &(*)(ios &, long), long)"
+    test_demangling_exact "lucid: __ct__11smanip_longFPFO3iosl_O3iosl" "smanip_long::smanip_long(ios &&(*)(ios &&, long), long)"
     test_demangling_exact "lucid: __ct__11stdiostreamFP4FILE" "stdiostream::stdiostream(FILE *)"
     test_demangling_exact "lucid: __ct__12strstreambufFPFl_PvPFPv_v" "strstreambuf::strstreambuf(void *(*)(long), void (*)(void *))"
     test_demangling_exact "lucid: __ct__12strstreambufFPUciT1" "strstreambuf::strstreambuf(unsigned char *, int, unsigned char *)"
@@ -584,12 +704,14 @@  proc test_lucid_style_demangling {} {
     test_demangling_exact "lucid: __ct__12strstreambufFv" "strstreambuf::strstreambuf(void)"
     test_demangling_exact "lucid: __ct__13strstreambaseFPciT1" "strstreambase::strstreambase(char *, int, char *)"
     test_demangling_exact "lucid: __ct__3fooFR3foo" "foo::foo(foo &)"
+    test_demangling_exact "lucid: __ct__3fooFO3foo" "foo::foo(foo &&)"
 
     test_demangling_exact "lucid: __ct__3fooFi" "foo::foo(int)"
     test_demangling_exact "lucid: __ct__3fooFiN31" "foo::foo(int, int, int, int)"
     test_demangling "lucid: __ct__3fooFiPCc" \
 	"foo::foo\[(\]+int, (const char|char const) \[*\]+\[)\]+"
     test_demangling_exact "lucid: __ct__3fooFiR3fooT1T2T1T2" "foo::foo(int, foo &, int, foo &, int, foo &)"
+    test_demangling_exact "lucid: __ct__3fooFiO3fooT1T2T1T2" "foo::foo(int, foo &&, int, foo &&, int, foo &&)"
     test_demangling_exact "lucid: __ct__3iosFP9streambuf" "ios::ios(streambuf *)"
     test_demangling_exact "lucid: __ct__7filebufFiPcT1" "filebuf::filebuf(int, char *, int)"
     test_demangling "lucid: __ct__7fstreamFPCciT2" \
@@ -692,6 +814,7 @@  proc test_lucid_style_demangling {} {
     test_demangling_exact "lucid: bitalloc__3iosSFv" "ios::bitalloc(void) static"
     test_demangling_exact "lucid: chr__FiT1" "chr(int, int)"
     test_demangling_exact "lucid: complex_error__FR11c_exception" "complex_error(c_exception &)"
+    test_demangling_exact "lucid: complex_error__FO11c_exception" "complex_error(c_exception &&)"
     test_demangling_exact "lucid: complexfunc2__FPFPc_i" "complexfunc2(int (*)(char *))"
     test_demangling_exact "lucid: complexfunc3__FPFPFPl_s_i" "complexfunc3(int (*)(short (*)(long *)))"
 
@@ -703,6 +826,7 @@  proc test_lucid_style_demangling {} {
     test_demangling_exact "lucid: conv10__FlPc" "conv10(long, char *)"
     test_demangling_exact "lucid: conv16__FUlPc" "conv16(unsigned long, char *)"
     test_demangling_exact "lucid: dec__FR3ios" "dec(ios &)"
+    test_demangling_exact "lucid: dec__FO3ios" "dec(ios &&)"
     test_demangling_exact "lucid: dec__Fli" "dec(long, int)"
     test_demangling_exact "lucid: dofield__FP7ostreamPciT2T3" "dofield(ostream *, char *, int, char *, int)"
 
@@ -710,12 +834,16 @@  proc test_lucid_style_demangling {} {
     test_demangling_exact "lucid: flags__3iosFv" "ios::flags(void)"
     test_demangling_exact "lucid: foo__FiN31" "foo(int, int, int, int)"
     test_demangling_exact "lucid: foo__FiR3fooT1T2T1T2" "foo(int, foo &, int, foo &, int, foo &)"
+    test_demangling_exact "lucid: foo__FiO3fooT1T2T1T2" "foo(int, foo &&, int, foo &&, int, foo &&)"
     test_demangling_exact "lucid: foo___3barFl" "bar::foo_(long)"
     test_demangling "lucid: form__FPCce" "form\[(\]+(const char|char const) \[*\]+,...\[)\]+"
     test_demangling_exact "lucid: get__7istreamFPcic" "istream::get(char *, int, char)"
     test_demangling_exact "lucid: get__7istreamFR9streambufc" "istream::get(streambuf &, char)"
+    test_demangling_exact "lucid: get__7istreamFO9streambufc" "istream::get(streambuf &&, char)"
     test_demangling_exact "lucid: get_complicated__7istreamFRUc" "istream::get_complicated(unsigned char &)"
+    test_demangling_exact "lucid: get_complicated__7istreamFOUc" "istream::get_complicated(unsigned char &&)"
     test_demangling_exact "lucid: get_complicated__7istreamFRc" "istream::get_complicated(char &)"
+    test_demangling_exact "lucid: get_complicated__7istreamFOc" "istream::get_complicated(char &&)"
     test_demangling_exact "lucid: getline__7istreamFPUcic" "istream::getline(unsigned char *, int, char)"
     test_demangling_exact "lucid: getline__7istreamFPcic" "istream::getline(char *, int, char)"
 
@@ -764,9 +892,13 @@  proc test_lucid_style_demangling {} {
 
     test_demangling_exact "lucid: read__7istreamFPci" "istream::read(char *, int)"
     test_demangling_exact "lucid: resetiosflags__FR3iosl" "resetiosflags(ios &, long)"
+    test_demangling_exact "lucid: resetiosflags__FO3iosl" "resetiosflags(ios &&, long)"
     test_demangling_exact "lucid: restore_errno__FRi" "restore_errno(int &)"
+    test_demangling_exact "lucid: restore_errno__FOi" "restore_errno(int &&)"
     test_demangling_exact "lucid: rs_complicated__7istreamFRUc" "istream::rs_complicated(unsigned char &)"
+    test_demangling_exact "lucid: rs_complicated__7istreamFOUc" "istream::rs_complicated(unsigned char &&)"
     test_demangling_exact "lucid: rs_complicated__7istreamFRc" "istream::rs_complicated(char &)"
+    test_demangling_exact "lucid: rs_complicated__7istreamFOc" "istream::rs_complicated(char &&)"
     test_demangling_exact "lucid: seekg__7istreamFl8seek_dir" "istream::seekg(long, seek_dir)"
     test_demangling_exact "lucid: seekoff__12strstreambufFl8seek_diri" "strstreambuf::seekoff(long, seek_dir, int)"
     test_demangling_exact "lucid: seekoff__9streambufFlQ2_3ios12ios_seek_diri" "streambuf::seekoff(long, ios::ios_seek_dir, int)"
@@ -775,11 +907,13 @@  proc test_lucid_style_demangling {} {
     test_demangling_exact "lucid: setb__9streambufFPcT1i" "streambuf::setb(char *, char *, int)"
 
     test_demangling_exact "lucid: setb__FR3iosi" "setb(ios &, int)"
+    test_demangling_exact "lucid: setb__FO3iosi" "setb(ios &&, int)"
     test_demangling_exact "lucid: setbuf__11fstreambaseFPci" "fstreambase::setbuf(char *, int)"
     test_demangling_exact "lucid: setbuf__9streambufFPUci" "streambuf::setbuf(unsigned char *, int)"
     test_demangling_exact "lucid: setbuf__9streambufFPciT2" "streambuf::setbuf(char *, int, int)"
     test_demangling_exact "lucid: setf__3iosFlT1" "ios::setf(long, long)"
     test_demangling_exact "lucid: setfill__FR3iosi" "setfill(ios &, int)"
+    test_demangling_exact "lucid: setfill__FO3iosi" "setfill(ios &&, int)"
     test_demangling_exact "lucid: setg__9streambufFPcN21" "streambuf::setg(char *, char *, char *)"
     test_demangling_exact "lucid: setp__9streambufFPcT1" "streambuf::setp(char *, char *)"
 
@@ -835,34 +969,54 @@  proc test_arm_style_demangling {} {
 	"g\[(\]+T, long \[*\]+, (const long|long const) \[*\]+, long \[*\]+\[)\]+"
     test_demangling "arm: g__F1RRlRClT2" \
 	"g\[(\]+R, long &, (const long|long const) &, long &\[)\]+"
+    test_demangling "arm: g__F1ROlOClT2" \
+	"g\[(\]+R, long &&, (const long|long const) &&, long &&\[)\]+"
     test_demangling "arm: g__F1TPiPCiT2" \
 	"g\[(\]+T, int \[*\]+, (const int|int const) \[*\]+, int \[*\]+\[)\]+"
     test_demangling "arm: g__F1RRiRCiT2" \
 	"g\[(\]+R, int &, (const int|int const) &, int &\[)\]+"
+    test_demangling "arm: g__F1ROiOCiT2" \
+	"g\[(\]+R, int &&, (const int|int const) &&, int &&\[)\]+"
     test_demangling "arm: g__F1TPsPCsT2" \
 	"g\[(\]+T, short \[*\]+, (const short|short const) \[*\]+, short \[*\]+\[)\]+"
     test_demangling "arm: g__F1RRsRCsT2" \
 	"g\[(\]+R, short &, (const short|short const) &, short &\[)\]+"
+    test_demangling "arm: g__F1ROsOCsT2" \
+	"g\[(\]+R, short &&, (const short|short const) &&, short &&\[)\]+"
     test_demangling "arm: g__F1TPcPCcT2" \
 	"g\[(\]+T, char \[*\]+, (const char|char const) \[*\]+, char \[*\]+\[)\]+"
     test_demangling "arm: g__F1RRcRCcT2" \
 	"g\[(\]+R, char &, (const char|char const) &, char &\[)\]+"
+    test_demangling "arm: g__F1ROcOCcT2" \
+	"g\[(\]+R, char &&, (const char|char const) &&, char &&\[)\]+"
 
     test_demangling_exact "arm: __ct__21T5__pt__11_PFiPPdPv_iFi" "T5<int (*)(int, double **, void *)>::T5(int)"
 
     test_demangling "arm: __gt__FRC2T2c" \
 	"operator>\[(\]+(const T2|T2 const) &, char\[)\]+"
+    test_demangling "arm: __gt__FOC2T2c" \
+	"operator>\[(\]+(const T2|T2 const) &&, char\[)\]+"
     test_demangling "arm: __ge__FRC2T2c" \
 	"operator>=\[(\]+(const T2|T2 const) &, char\[)\]+"
+    test_demangling "arm: __ge__FOC2T2c" \
+	"operator>=\[(\]+(const T2|T2 const) &&, char\[)\]+"
     test_demangling "arm: __lt__FRC2T2c" \
 	"operator<\[(\]+(const T2|T2 const) &, char\[)\]+"
+    test_demangling "arm: __lt__FOC2T2c" \
+	"operator<\[(\]+(const T2|T2 const) &&, char\[)\]+"
 
     test_demangling "arm: __le__FRC2T2c" \
 	"operator<=\[(\]+(const T2|T2 const) &, char\[)\]+"
+    test_demangling "arm: __le__FOC2T2c" \
+	"operator<=\[(\]+(const T2|T2 const) &&, char\[)\]+"
     test_demangling "arm: __ne__FRC2T2c" \
 	"operator!=\[(\]+(const T2|T2 const) &, char\[)\]+"
+    test_demangling "arm: __ne__FOC2T2c" \
+	"operator!=\[(\]+(const T2|T2 const) &&, char\[)\]+"
     test_demangling "arm: __eq__FRC2T2c" \
 	"operator==\[(\]+(const T2|T2 const) &, char\[)\]+"
+    test_demangling "arm: __eq__FOC2T2c" \
+	"operator==\[(\]+(const T2|T2 const) &&, char\[)\]+"
     test_demangling_exact "arm: __amd__FR2T2i" "operator%=(T2 &, int)"
     test_demangling_exact "arm: __adv__FR2T2i" "operator/=(T2 &, int)"
     test_demangling_exact "arm: __amu__FR2T2i" "operator*=(T2 &, int)"
@@ -1127,6 +1281,8 @@  proc test_arm_style_demangling {} {
 
     test_demangling_exact "arm: __ct__25DListNode__pt__9_R6RLabelFR6RLabelP25DListNode__pt__9_R6RLabelT2" \
 	"DListNode<RLabel &>::DListNode(RLabel &, DListNode<RLabel &> *, DListNode<RLabel &> *)"
+    test_demangling_exact "arm: __ct__25DListNode__pt__9_O6RLabelFO6RLabelP25DListNode__pt__9_O6RLabelT2" \
+	"DListNode<RLabel &&>::DListNode(RLabel &&, DListNode<RLabel &&> *, DListNode<RLabel &&> *)"
 
     test_demangling_exact "arm: bar__3fooFiT16FooBar" "foo::bar(int, int, FooBar)"
 
@@ -1157,18 +1313,26 @@  proc test_hp_style_demangling {} {
 	"g\[(\]+T, long \[*\]+, (const long|long const) \[*\]+, long \[*\]+\[)\]+"
     test_demangling "hp: g__F1RRlRClT2" \
 	"g\[(\]+R, long &, (const long|long const) &, long &\[)\]+"
+    test_demangling "hp: g__F1ROlOClT2" \
+	"g\[(\]+R, long &&, (const long|long const) &&, long &&\[)\]+"
     test_demangling "hp: g__F1TPiPCiT2" \
 	"g\[(\]+T, int \[*\]+, (const int|int const) \[*\]+, int \[*\]+\[)\]+"
     test_demangling "hp: g__F1RRiRCiT2" \
 	"g\[(\]+R, int &, (const int|int const) &, int &\[)\]+"
+    test_demangling "hp: g__F1ROiOCiT2" \
+	"g\[(\]+R, int &&, (const int|int const) &&, int &&\[)\]+"
     test_demangling "hp: g__F1TPsPCsT2" \
 	"g\[(\]+T, short \[*\]+, (const short|short const) \[*\]+, short \[*\]+\[)\]+"
     test_demangling "hp: g__F1RRsRCsT2" \
 	"g\[(\]+R, short &, (const short|short const) &, short &\[)\]+"
+    test_demangling "hp: g__F1ROsOCsT2" \
+	"g\[(\]+R, short &&, (const short|short const) &&, short &&\[)\]+"
     test_demangling "hp: g__F1TPcPCcT2" \
 	"g\[(\]+T, char \[*\]+, (const char|char const) \[*\]+, char \[*\]+\[)\]+"
     test_demangling "hp: g__F1RRcRCcT2" \
 	"g\[(\]+R, char &, (const char|char const) &, char &\[)\]+"
+    test_demangling "hp: g__F1ROcOCcT2" \
+	"g\[(\]+R, char &&, (const char|char const) &&, char &&\[)\]+"
 
     test_demangling "hp: __gt__FRC2T2c" \
 	"operator>\[(\]+(const T2|T2 const) &, char\[)\]+"
@@ -1476,6 +1640,8 @@  proc test_hp_style_demangling {} {
 
     test_demangling_exact "hp: __ct__9DListNodeXTR6RLabel__FR6RLabelP9DListNodeXTR6RLabel_T2" \
 	"DListNode<RLabel &>::DListNode(RLabel &, DListNode<RLabel &> *, DListNode<RLabel &> *)"
+    test_demangling_exact "hp: __ct__9DListNodeXTO6RLabel__FO6RLabelP9DListNodeXTO6RLabel_T2" \
+	"DListNode<RLabel &&>::DListNode(RLabel &&, DListNode<RLabel &&> *, DListNode<RLabel &&> *)"
 
 
     # Absolute integer constants in template args
@@ -1486,8 +1652,12 @@  proc test_hp_style_demangling {} {
     test_demangling_exact "hp: elem__6vectorXTiSN67__Fi" "vector<int,-67>::elem(int)"
     test_demangling_exact "hp: elem__6vectorXTiSM__SCFPPd" "vector<int,-2147483648>::elem(double **) static const"
     test_demangling_exact "hp: elem__6vectorXTiSN67UP4000TRs__Fi" "vector<int,-67,4000U,short &>::elem(int)"
+    test_demangling_exact "hp: elem__6vectorXTiSN67UP4000TOs__Fi" "vector<int,-67,4000U,short &&>::elem(int)"
     test_demangling_exact "hp: elem__6vectorXTiSN67TRdTFPv_i__Fi" "vector<int,-67,double &,int (void *)>::elem(int)"
+    test_demangling_exact "hp: elem__6vectorXTiSN67TOdTFPv_i__Fi" "vector<int,-67,double &&,int (void *)>::elem(int)"
     test_demangling_exact "hp: X__6vectorXTiSN67TdTPvUP5TRs" "vector<int,-67,double,void *,5U,short &>::X"
+    test_demangling_exact "hp: X__6vectorXTiSN67TdTPvUP5TOs" "vector<int,-67,double,void *,5U,short &&>::X"
+
 
     # Named constants in template args
 
diff --git a/gdb/testsuite/gdb.cp/overload.cc b/gdb/testsuite/gdb.cp/overload.cc
index 5c782a4..a977c43 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,9 @@  int overload1arg (double);
 int overload1arg (int*);
 int overload1arg (void*);
 
+int overload1arg (foo &);
+int overload1arg (foo &&);
+
 int overloadfnarg (void);
 int overloadfnarg (int);
 int overloadfnarg (int, int (*) (int));
@@ -114,6 +119,7 @@  int main ()
     double arg12 = 200.0;
     int arg13 = 200;
     char arg14 = 'a';
+    foo arg15(5);
 
     A a;
     B b;
@@ -153,6 +159,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 +179,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 bac6375..8fcfcca 100644
--- a/gdb/testsuite/gdb.cp/overload.exp
+++ b/gdb/testsuite/gdb.cp/overload.exp
@@ -28,7 +28,7 @@  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 +53,7 @@  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 +72,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 \\*\\);"
+set re_methods  "${re_methods}${ws}int overload1arg\\(foo &\\);"
+set re_methods  "${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\\)\\);"
@@ -259,6 +261,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 12a5bb3..d0ef56b 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;
@@ -28,7 +30,12 @@  struct Child : public Parent {
 
 int f1(Parent& R)
 {
-  return R.id;			/* Set breakpoint marker3 here.  */
+  return R.id;			/* Set breakpoint marker4 here.  */
+}
+
+int f1(Parent&& R)
+{
+  return R.id;			/* Set breakpoint marker5 here.  */
 }
 
 int f2(Child& C)
@@ -36,6 +43,11 @@  int f2(Child& C)
   return f1(C);			/* Set breakpoint marker2 here.  */
 }
 
+int f2(Child&& C)
+{
+  return f1(std::move(C));                 /* Set breakpoint marker3 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 7878907..b1feac4 100644
--- a/gdb/testsuite/gdb.cp/ref-params.exp
+++ b/gdb/testsuite/gdb.cp/ref-params.exp
@@ -24,7 +24,7 @@  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 +48,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 "marker3 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 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 +77,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 eb39370..3d5984d 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 61827ab..1cb25ef 100644
--- a/gdb/testsuite/gdb.cp/ref-types.exp
+++ b/gdb/testsuite/gdb.cp/ref-types.exp
@@ -24,7 +24,7 @@  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 +127,47 @@  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 &&\\) @$hex: -1.*$gdb_prompt $" {
+        pass "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_multiple "ptype rrt" "ptype rrt" {
+    -re "type = short &&.*$gdb_prompt $"  { pass "ptype rrt" }
+    -re "type = short int &&.*$gdb_prompt $"  { pass "ptype rrt" }
+}
+
+gdb_test "print *rrpt" ".\[0-9\]* = -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_multiple "ptype rrpt" "ptype rrpt" {
+    -re "type = short \\*&&.*$gdb_prompt $"  { pass "ptype rrpt" }
+    -re "type = short int \\*&&.*$gdb_prompt $"  { pass "ptype rrpt" }
+}
+
+gdb_test "print rrat\[0\]" ".\[0-9\]* = 0" "print value of rrat\[0\]"
+
+gdb_test_multiple "ptype rrat" "ptype rrat" {
+    -re "type = short \\\(&&\\\)\\\[4\\\].*$gdb_prompt $"  { pass "ptype rrat" }
+    -re "type = short int \\\(&&\\\)\\\[4\\\].*$gdb_prompt $"  { pass "ptype rrat" }
+}
+
+gdb_test "print rrat\[1\]" ".\[0-9\]* = 1" "print value of rrat\[1\]"
+gdb_test "print rrat\[2\]" ".\[0-9\]* = 2" "print value of rrat\[2\]"
+gdb_test "print rrat\[3\]" ".\[0-9\]* = 3" "print value of rrat\[3\]"
+
 
 if ![runto 'f'] then {
     perror "couldn't run to f"
@@ -270,3 +311,96 @@  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_multiple "ptype rrS" "ptype rrS" {
+    -re "type = short &&.*$gdb_prompt $"  { pass "ptype rrS" }
+    -re "type = short int &&.*$gdb_prompt $"  { pass "ptype rrS" }
+}
+
+gdb_test_multiple "ptype rrUS" "ptype rrUS" {
+    -re "type = unsigned short &&.*$gdb_prompt $"  { pass "ptype rrUS" }
+    -re "type = short unsigned int &&.*$gdb_prompt $"  { pass "ptype rrUS" }
+}
+
+gdb_test "ptype rrI" "type = int &&"
+
+gdb_test "ptype rrUI" "type = unsigned int &&"
+
+gdb_test_multiple "ptype rrL" "ptype rrL" {
+    -re "type = long &&.*$gdb_prompt $"  { pass "ptype rrL" }
+    -re "type = long int &&.*$gdb_prompt $"  { pass "ptype rrL" }
+}
+
+gdb_test_multiple "ptype rrUL" "ptype rrUL" {
+    -re "type = unsigned long &&.*$gdb_prompt $"  { pass "ptype rrUL" }
+    -re "type = long unsigned int &&.*$gdb_prompt $"  { pass "ptype rrUL" }
+}
+
+gdb_test "ptype rrF" "type = float &&"
+
+gdb_test "ptype rrD" "type = double &&"
+
+gdb_test "print rrC" ".\[0-9\]* = \\(char &&\\) @$hex: 65 \'A\'" \
+    "print value of rrC"
+
+gdb_test "print rrUC" \
+    ".\[0-9\]* = \\(unsigned char &&\\) @$hex: 21 \'.025\'" \
+    "print value of rrUC"
+
+gdb_test_multiple "print rrS" "print value of rrS" {
+    -re ".\[0-9\]* = \\(short &&\\) @$hex: -14.*$gdb_prompt $" {
+        pass "print value of rrS"
+    }
+    -re ".\[0-9\]* = \\(short int &&\\) @$hex: -14.*$gdb_prompt $" {
+        pass "print value of rrS"
+    }
+}
+
+gdb_test_multiple "print rrUS" "print value of rrUS" {
+    -re ".\[0-9\]* = \\(unsigned short &&\\) @$hex: 7.*$gdb_prompt $" {
+        pass "print value of rrUS"
+    }
+    -re ".\[0-9\]* = \\(short unsigned int &&\\) @$hex: 7.*$gdb_prompt $" {
+        pass "print value of rrUS"
+    }
+}
+
+gdb_test "print rrI" ".\[0-9\]* = \\(int &&\\) @$hex: 102" \
+	"print value of rrI"
+
+gdb_test "print rrUI" \
+    ".\[0-9\]* = \\(unsigned int &&\\) @$hex: 1002" \
+        "print value of UI"
+
+gdb_test_multiple "print rrL" "print value of rrL" {
+    -re ".\[0-9\]* = \\(long &&\\) @$hex: -234.*$gdb_prompt $" {
+        pass "print value of rrL"
+    }
+    -re ".\[0-9\]* = \\(long int &&\\) @$hex: -234.*$gdb_prompt $" {
+        pass "print value of rrL"
+    }
+}
+
+gdb_test_multiple "print rrUL" "print value of rrUL" {
+    -re ".\[0-9\]* = \\(unsigned long &&\\) @$hex: 234.*$gdb_prompt $" {
+        pass "print value of rrUL"
+    }
+    -re ".\[0-9\]* = \\(long unsigned int &&\\) @$hex: 234.*$gdb_prompt $" {
+        pass "print value of rrUL"
+    }
+}
+
+gdb_test "print rrF" \
+    ".\[0-9\]* = \\(float &&\\) @$hex: 1.2\[0-9\]*e\\+0?10.*" \
+    "print value of rrF"
+
+gdb_test "print rrD" \
+    ".\[0-9\]* = \\(double &&\\) @$hex: -1.375e-123.*" \
+    "print value of rrD"