Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2006-2020 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 | # Tests for rvalue reference parameters of types and their subtypes in GDB, | |
17 | # based on gdb.cp/ref-params.exp. | |
18 | ||
19 | if {[skip_cplus_tests]} { continue } | |
20 | ||
21 | standard_testfile .cc | |
22 | ||
23 | if {[prepare_for_testing $testfile.exp $testfile $srcfile \ | |
24 | {debug c++ additional_flags="-std=gnu++11"}] == 1} { | |
25 | return -1 | |
26 | } | |
27 | ||
28 | proc gdb_start_again {text prefix} { | |
29 | global binfile | |
30 | global srcfile | |
31 | ||
32 | with_test_prefix $prefix { | |
33 | clean_restart $binfile | |
34 | ||
35 | runto ${srcfile}:[gdb_get_line_number $text] | |
36 | } | |
37 | } | |
38 | ||
39 | set t "print value of f1 on (Child&&) in main" | |
40 | gdb_start_again "marker1 here" $t | |
41 | gdb_test "print f1(static_cast<Child&&>(Q))" ".* = 40.*" $t | |
42 | ||
43 | set t "print value of f2 on (Child&&) in main" | |
44 | gdb_start_again "marker1 here" $t | |
45 | gdb_test "print f2(static_cast<Child&&>(Q))" ".* = 40.*" $t | |
46 | ||
47 | set t "print value of Child&& in f2" | |
48 | gdb_start_again "marker2 here" $t | |
49 | gdb_test "print C" ".*id = 42.*" $t | |
50 | ||
c0f55cc6 AV |
51 | gdb_test "print f1 (static_cast<Child&&> (C))" ".* = 42.*" \ |
52 | "print value of f1 on Child&& in f2" | |
53 | ||
54 | set t "print value of Parent&& in f1" | |
55 | gdb_start_again "marker3 here" $t | |
56 | gdb_test "print R" ".*id = 41.*" $t | |
57 | ||
58 | set t "print f1(static_cast<MultiChild&&>(MQ))" | |
59 | gdb_start_again "breakpoint MQ here" $t | |
60 | gdb_test $t ".* = 53" | |
61 | ||
62 | set t "print mf1(static_cast<MultiChild&&>(MQ))" | |
63 | gdb_start_again "breakpoint MQ here" $t | |
64 | gdb_test $t ".* = 106" | |
65 | ||
66 | set t "print mf2(static_cast<MultiChild&&>(MQ))" | |
67 | gdb_start_again "breakpoint MQ here" $t | |
68 | gdb_test $t ".* = 106" |