Commit | Line | Data |
---|---|---|
88b9d363 | 1 | # Copyright 2006-2022 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 \ | |
72fbdf83 | 24 | {debug c++ additional_flags="-std=gnu++11"}] == -1} { |
c0f55cc6 AV |
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 | ||
30ab3586 AB |
43 | gdb_test "print f3(static_cast<int&&> (global_int))" " = 8" |
44 | gdb_test "print f4(static_cast<float&&> (global_float))" " = 3" | |
45 | ||
46 | gdb_test "print static_cast<int&> (global_int)" " = \\(int &\\) @$hex: 7" | |
47 | gdb_test "print static_cast<int&&> (global_int)" " = \\(int &&\\) @$hex: 7" | |
48 | ||
49 | gdb_test "print static_cast<float&> (global_float)" " = \\(float &\\) @$hex: 3\\.$decimal" | |
50 | gdb_test "print static_cast<float&&> (global_float)" " = \\(float &&\\) @$hex: 3\\.$decimal" | |
51 | ||
c0f55cc6 AV |
52 | set t "print value of f2 on (Child&&) in main" |
53 | gdb_start_again "marker1 here" $t | |
54 | gdb_test "print f2(static_cast<Child&&>(Q))" ".* = 40.*" $t | |
55 | ||
56 | set t "print value of Child&& in f2" | |
57 | gdb_start_again "marker2 here" $t | |
58 | gdb_test "print C" ".*id = 42.*" $t | |
59 | ||
c0f55cc6 AV |
60 | gdb_test "print f1 (static_cast<Child&&> (C))" ".* = 42.*" \ |
61 | "print value of f1 on Child&& in f2" | |
62 | ||
63 | set t "print value of Parent&& in f1" | |
64 | gdb_start_again "marker3 here" $t | |
65 | gdb_test "print R" ".*id = 41.*" $t | |
66 | ||
67 | set t "print f1(static_cast<MultiChild&&>(MQ))" | |
68 | gdb_start_again "breakpoint MQ here" $t | |
69 | gdb_test $t ".* = 53" | |
70 | ||
71 | set t "print mf1(static_cast<MultiChild&&>(MQ))" | |
72 | gdb_start_again "breakpoint MQ here" $t | |
73 | gdb_test $t ".* = 106" | |
74 | ||
75 | set t "print mf2(static_cast<MultiChild&&>(MQ))" | |
76 | gdb_start_again "breakpoint MQ here" $t | |
77 | gdb_test $t ".* = 106" |