Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Patch for incorrect handling of references to pointers [pr1147]
@ 2008-05-09  1:53 Paul Pluzhnikov
  2008-05-17 13:58 ` Paul Pluzhnikov
  2008-06-05 20:38 ` Daniel Jacobowitz
  0 siblings, 2 replies; 8+ messages in thread
From: Paul Pluzhnikov @ 2008-05-09  1:53 UTC (permalink / raw)
  To: gdb-patches; +Cc: Doug Evans

[-- Attachment #1: Type: text/plain, Size: 567 bytes --]

Greetings,

Attached patch fixes incorrect handling of "this" when reference
to pointer is used:
  http://sourceware.org/cgi-bin/gnatsweb.pl?cmd=view&database=gdb&pr=1147
and adds a test case for it.

Thanks,
-- 
Paul Pluzhnikov


ChangeLog:

2008-05-08  Paul Pluzhnikov  <ppluzhnikov@google.com>

       * gdb/valopts.c (find_overload_match): Handle references
       to pointers.

testsuite/ChangeLog:

2008-05-08  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* gdb.cp/call-c.exp: Test for incorrect handling of reference
	to pointer.
	* gdb.cp/call-c.cc: Likewise.

[-- Attachment #2: patch-1147.txt --]
[-- Type: text/plain, Size: 1227 bytes --]

--- gdb/testsuite/gdb.cp/call-c.cc.orig	2008-05-08 14:01:57.000000000 -0700
+++ gdb/testsuite/gdb.cp/call-c.cc	2008-05-08 13:40:09.851165000 -0700
@@ -21,7 +21,18 @@ int func(int x)
    return x;
 }
 
+struct Foo {
+  Foo() : x_(1) { }
+  int func() const { return x_; }
+ private:
+  int x_;
+};
+
 int main()
 {
+    Foo f;
+    Foo *pf = &f;
+    Foo* &rf = pf;
+    rf->func();
     return func(0);
 }
--- gdb/testsuite/gdb.cp/call-c.exp.orig	2008-05-08 14:01:57.000000000 -0700
+++ gdb/testsuite/gdb.cp/call-c.exp	2008-05-08 13:54:14.497857000 -0700
@@ -44,3 +44,6 @@ gdb_load ${binfile}
 runto_main
 
 gdb_test "print foo(1)" "\\\$$decimal = 1"
+send_gdb "next\nnext\nnext\n"
+gdb_expect -re "$gdb_prompt $"
+gdb_test "print rf->func()" "\\\$$decimal = 1"
--- gdb/valops.c.orig	2008-05-08 14:01:57.000000000 -0700
+++ gdb/valops.c	2008-05-08 13:57:14.320875000 -0700
@@ -1919,7 +1919,8 @@ find_overload_match (struct type **arg_t
   if (objp)
     {
       if (TYPE_CODE (value_type (temp)) != TYPE_CODE_PTR
-	  && TYPE_CODE (value_type (*objp)) == TYPE_CODE_PTR)
+	  && (TYPE_CODE (value_type (*objp)) == TYPE_CODE_PTR
+	      || (TYPE_CODE (value_type (*objp)) == TYPE_CODE_REF)))
 	{
 	  temp = value_addr (temp);
 	}

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-06-06 18:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-09  1:53 [RFA] Patch for incorrect handling of references to pointers [pr1147] Paul Pluzhnikov
2008-05-17 13:58 ` Paul Pluzhnikov
2008-05-28  6:52   ` Paul Pluzhnikov
2008-06-05  1:19   ` Paul Pluzhnikov
2008-06-05 20:38 ` Daniel Jacobowitz
2008-06-06  0:52   ` Paul Pluzhnikov
2008-06-06  2:36     ` Daniel Jacobowitz
2008-06-06 18:32       ` Paul Pluzhnikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox