Commit | Line | Data |
---|---|---|
c0f55cc6 AV |
1 | # Copyright 2014-2017 Free Software Foundation, Inc. |
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 | # sizeof() tests with rvalue reference parameter types, based on | |
17 | # gdb.cp/cpsizeof.exp. | |
18 | ||
19 | standard_testfile .cc | |
20 | ||
21 | if {[skip_cplus_tests]} { continue } | |
22 | ||
23 | if {[prepare_for_testing ${testfile}.exp $testfile $srcfile \ | |
24 | {debug c++ additional_flags="-std=gnu++11"}] } { | |
25 | return -1 | |
26 | } | |
27 | ||
28 | if {![runto_main]} { | |
29 | perror "could not run to main" | |
30 | continue | |
31 | } | |
32 | ||
33 | gdb_breakpoint [gdb_get_line_number "break here"] | |
34 | gdb_continue_to_breakpoint "break here" | |
35 | ||
36 | # Compare sizeof from the compiler and gdb. Do this once with the actual | |
37 | # type name and once with a reference variable. | |
38 | foreach v {char int long float double a4 a8 a12 Class Union Enum c4 u8 e12} { | |
39 | gdb_test "print size_$v == sizeof (${v}&&)" "= true" | |
40 | gdb_test "print size_$v == sizeof (${v}_rref)" "= true" | |
41 | gdb_test "print size_${v}p == sizeof (${v}*&&)" "= true" | |
42 | gdb_test "print size_${v}p == sizeof (${v}p_rref)" "= true" | |
43 | } |