aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSiva Chandra <sivachandra@chromium.org>2014-09-09 06:03:42 -0700
committerSiva Chandra <sivachandra@chromium.org>2014-10-15 04:25:32 -0700
commit82c48ac732edb0155288a93ef3dd39625ff2d2e1 (patch)
treeaaa8e3ea7ea59d494f28b9a18ca61a1e0a0b20da /gdb
parent778811d5e7eb96b5ecb848033ffaa2df455a921e (diff)
downloadgdb-82c48ac732edb0155288a93ef3dd39625ff2d2e1.zip
gdb-82c48ac732edb0155288a93ef3dd39625ff2d2e1.tar.gz
gdb-82c48ac732edb0155288a93ef3dd39625ff2d2e1.tar.bz2
Fix gnuv3_pass_by_reference to lookup copy c-tors with qualified args.
Before this, a copy constructor declared as in the following snippet was not being treated as a copy constructor. class A { public: A (A &); // OK. A (const A &); // Not being treated as a copy constructor because of the // 'const' qualifier. }; gdb/ChangeLog: PR c++/13403 PR c++/15154 * gnu-v3-abi.c (gnuv3_pass_by_reference): Lookup copy constructors with qualified args.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/gnu-v3-abi.c16
2 files changed, 18 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9423d69..c33f6cc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2014-10-15 Siva Chandra Reddy <sivachandra@google.com>
+
+ PR c++/13403
+ PR c++/15154
+ * gnu-v3-abi.c (gnuv3_pass_by_reference): Lookup copy constructors
+ with qualified args.
+
2014-10-14 Joel Brobecker <brobecker@adacore.com>
* ada-lang.c (ada_evaluate_subexp) <BINOP_ADD>: Add handling
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index d02c8bc..558ec06 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -1312,11 +1312,17 @@ gnuv3_pass_by_reference (struct type *type)
/* If this method takes two arguments, and the second argument is
a reference to this class, then it is a copy constructor. */
- if (TYPE_NFIELDS (fieldtype) == 2
- && TYPE_CODE (TYPE_FIELD_TYPE (fieldtype, 1)) == TYPE_CODE_REF
- && check_typedef (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (fieldtype,
- 1))) == type)
- return 1;
+ if (TYPE_NFIELDS (fieldtype) == 2)
+ {
+ struct type *arg_type = TYPE_FIELD_TYPE (fieldtype, 1);
+ struct type *arg_target_type;
+
+ arg_target_type = check_typedef (TYPE_TARGET_TYPE (arg_type));
+
+ if (TYPE_CODE (arg_type) == TYPE_CODE_REF
+ && class_types_same_p (arg_target_type, type))
+ return 1;
+ }
}
/* Even if all the constructors and destructors were artificial, one