This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v3 11/11] [PR gdb/14441] gdb: testsuite: add rvalue reference tests
- From: Keith Seitz <keiths at redhat dot com>
- To: Artemiy Volkov <artemiyv at acm dot org>, gdb-patches at sourceware dot org
- Date: Wed, 16 Mar 2016 15:48:22 -0700
- Subject: Re: [PATCH v3 11/11] [PR gdb/14441] gdb: testsuite: add rvalue reference tests
- Authentication-results: sourceware.org; auth=none
- References: <1453229609-20159-1-git-send-email-artemiyv at acm dot org> <1457147955-21871-1-git-send-email-artemiyv at acm dot org> <1457147955-21871-12-git-send-email-artemiyv at acm dot org>
On 03/04/2016 07:19 PM, Artemiy Volkov wrote:
> diff --git a/gdb/testsuite/gdb.cp/overload.cc b/gdb/testsuite/gdb.cp/overload.cc
> index 5c782a4..05cbded 100644
> --- a/gdb/testsuite/gdb.cp/overload.cc
> +++ b/gdb/testsuite/gdb.cp/overload.cc
> @@ -1,10 +1,12 @@
> #include <stddef.h>
> +#include <utility>
>
> class foo {
> public:
> foo (int);
> foo (int, const char *);
> foo (foo&);
> + foo (foo&&);
> ~foo ();
> void foofunc (int);
> void foofunc (int, signed char *);
> @@ -27,6 +29,14 @@ int overload1arg (double);
> int overload1arg (int*);
> int overload1arg (void*);
>
> +typedef foo &foo_lval_ref;
> +typedef foo &&foo_rval_ref;
> +
> +int overload1arg (foo &);
> +int overload1arg (foo &&);
> +int overload1arg (foo_lval_ref);
> +int overload1arg (foo_rval_ref);
> +
With GCC6, I am getting the build error "cannot overload `int
overload1arg(foo &)' with `int overload1arg(foo_lval_ref)'". Likewise
with foo &&/foo_rval_ref.
> int overloadfnarg (void);
> int overloadfnarg (int);
> int overloadfnarg (int, int (*) (int));
> diff --git a/gdb/testsuite/gdb.cp/ref-types.exp b/gdb/testsuite/gdb.cp/ref-types.exp
> index 3b557f9..fbaafc1 100644
> --- a/gdb/testsuite/gdb.cp/ref-types.exp
> +++ b/gdb/testsuite/gdb.cp/ref-types.exp
> @@ -127,6 +128,35 @@ gdb_test "print ras\[1\]" ".\[0-9\]* = 1" "print value of ras\[1\]"
> gdb_test "print ras\[2\]" ".\[0-9\]* = 2" "print value of ras\[2\]"
> gdb_test "print ras\[3\]" ".\[0-9\]* = 3" "print value of ras\[3\]"
>
> +# rvalue reference tests
> +
> +gdb_test_multiple "print rrt" "print value of rrt" {
> + -re ".\[0-9\]* = \\(short( int)? &&\\) @$hex: -1.*$gdb_prompt $" {
> + pass "print value of rrt"
> + }
> + eof { fail "print rrt ($gdb dumped core) (fixme)" ; gdb_start_again ; }
> +}
> +
> +gdb_test "ptype rrt" "type = short( int)? &&.*$gdb_prompt $" "ptype rrt"
> +
This test doesn't pass -- the expected result is incorrect. Remove
".*$gdb_prompt $". gdb_test will automatically append this.
> +gdb_test "print *rrpt" ".$decimal = -1" "print value of *rrpt"
> +
> +# gdb had a bug about dereferencing a pointer type
> +# that would lead to wrong results
> +# if we try to examine memory at pointer value.
> +
> +gdb_test "x /hd rrpt" "$hex:\[ \t\]*-1" "examine value at rrpt"
> +
> +gdb_test "ptype rrpt" "type = short( int)? \\*&&.*$gdb_prompt $" "ptype rrpt"
> +
Same here.
> +gdb_test "print rrat\[0\]" ".$decimal = 0" "print value of rrat\[0\]"
> +
> +gdb_test "ptype rrat" "type = short( int)? \\\(&&\\\)\\\[4\\\].*$gdb_prompt $" "ptype rrat" {
> +
and here. There's also a stray '{' at the end here.
> +gdb_test "print rrat\[1\]" ".$decimal = 1" "print value of rrat\[1\]"
> +gdb_test "print rrat\[2\]" ".$decimal = 2" "print value of rrat\[2\]"
> +gdb_test "print rrat\[3\]" ".$decimal = 3" "print value of rrat\[3\]"
> +
>
> if ![runto 'f'] then {
> perror "couldn't run to f"
Thank you!
Keith