]>
Commit | Line | Data |
---|---|---|
e2882c85 | 1 | # Copyright 1998-2018 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 | ||
21 | if {[skip_cplus_tests]} { continue } | |
22 | ||
23 | load_lib "cp-support.exp" | |
24 | ||
25 | standard_testfile .cc | |
26 | ||
27 | if {[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 | ||
34 | if {![runto 'marker1']} { | |
35 | untested "couldn't run to marker1" | |
36 | return -1 | |
37 | } | |
38 | ||
39 | # Prevent symbol on address 0x0 being printed. | |
40 | gdb_test_no_output "set print symbol off" | |
41 | gdb_test "up" ".*main.*" "up from marker1" | |
42 | ||
43 | # Print the monster class type. | |
44 | cp_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);" } | |
52 | } | |
53 | ||
54 | gdb_test "print foo_rr_instance1.overload1arg(arg)" \ | |
55 | "\\$\[0-9\]+ = 1" \ | |
56 | "print call overloaded func foo & arg" | |
57 | ||
58 | gdb_test "print foo_rr_instance1.overload1arg(static_cast<foo&&>(arg))" \ | |
59 | "\\$\[0-9\]+ = 2" \ | |
60 | "print call overloaded func foo && arg" | |
61 | ||
62 | # Test lvalue vs rvalue function overloads | |
c0f55cc6 AV |
63 | gdb_test "print f (i)" "= 1" "lvalue reference overload" |
64 | ||
65 | gdb_test "print f (ci)" "= 2" "lvalue reference to const overload" | |
66 | ||
67 | setup_kfail "c++/15372" "*-*-*" | |
68 | gdb_test "print f (3)" "= 3" "rvalue reference overload" |