]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/testsuite/gdb.cp/rvalue-ref-overload.cc
gdb: fix overload resolution for see-through references
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.cp / rvalue-ref-overload.cc
index fa6cab03b051a0c184831361fcff4d4b7d741285..e3111d528bd623873d5094f60565ecd9750e21f5 100644 (file)
@@ -35,6 +35,8 @@ public:
 
   int overload1arg (foo_lval_ref);
   int overload1arg (foo_rval_ref);
+  int overloadConst (const foo &);
+  int overloadConst (const foo &&);
 };
 
 void
@@ -71,6 +73,11 @@ main ()
   // result = 1 + 2 + 3 + 3 = 9
   int result = f (i) + f (ci) + f (0) + f (std::move (i));
 
+  /* Overload resolution below requires both a CV-conversion
+     and reference conversion.  */
+  int test_const // = 3
+    = foo_rr_instance1.overloadConst (arg);
+
   marker1 (); // marker1-returns-here
   return result;
 }
@@ -84,3 +91,5 @@ foo::~foo ()                       {}
 
 int foo::overload1arg (foo_lval_ref arg)           { return 1; }
 int foo::overload1arg (foo_rval_ref arg)           { return 2; }
+int foo::overloadConst (const foo &arg)            { return 3; }
+int foo::overloadConst (const foo &&arg)           { return 4; }