gdb/testsuite: do minor clean-up in gdb.cp/rvalue-ref-overload.exp
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / rvalue-ref-overload.exp
CommitLineData
42a4f53d 1# Copyright 1998-2019 Free Software Foundation, Inc.
c0f55cc6
AV
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16# This file is part of the gdb testsuite
17
18# Tests for overloaded member functions with rvalue reference parameters,
19# based on gdb.cp/overload.exp.
20
21if {[skip_cplus_tests]} { continue }
22
23load_lib "cp-support.exp"
24
25standard_testfile .cc
26
27if {[prepare_for_testing $testfile.exp $testfile $srcfile \
28 {debug c++ additional_flags="-std=gnu++11"}]} {
29 return -1
30}
31
32# Set it up at a breakpoint so we can play with the variable values.
33
34if {![runto 'marker1']} {
35 untested "couldn't run to marker1"
36 return -1
37}
38
39# Prevent symbol on address 0x0 being printed.
40gdb_test_no_output "set print symbol off"
41gdb_test "up" ".*main.*" "up from marker1"
42
43# Print the monster class type.
44cp_test_ptype_class "foo_rr_instance1" "" "class" "foo" \
45 {
46 { method public "foo(void);" }
47 { method public "foo(foo_lval_ref);" }
48 { method public "foo(foo_rval_ref);" }
49 { method public "~foo();" }
50 { method public "int overload1arg(foo_lval_ref);" }
51 { method public "int overload1arg(foo_rval_ref);" }
06acc08f
TBA
52 { method public "int overloadConst(const foo &);" }
53 { method public "int overloadConst(const foo &&);" }
c0f55cc6
AV
54 }
55
c7d12402 56gdb_test "print foo_rr_instance1.overload1arg(arg)" "1"
c0f55cc6 57
c7d12402 58gdb_test "print foo_rr_instance1.overload1arg(static_cast<foo&&>(arg))" "2"
c0f55cc6 59
06acc08f
TBA
60gdb_test "print foo_rr_instance1.overloadConst(arg)" "3"
61
c0f55cc6 62# Test lvalue vs rvalue function overloads
c7d12402 63gdb_test "print f (i)" "1" "lvalue reference overload"
c0f55cc6 64
c7d12402 65gdb_test "print f (ci)" "2" "lvalue reference to const overload"
c0f55cc6
AV
66
67setup_kfail "c++/15372" "*-*-*"
c7d12402 68gdb_test "print f (3)" "3" "rvalue reference overload"
This page took 0.359745 seconds and 4 git commands to generate.