Fix gnuv3_pass_by_reference to lookup copy c-tors with qualified args.
[deliverable/binutils-gdb.git] / gdb / gnu-v3-abi.c
index 5a812132f9f929026d1e0f9563203d7dc3f390f4..558ec06ccfadffb6e3b775d143feb5e5fa902a14 100644 (file)
 #include "objfiles.h"
 #include "valprint.h"
 #include "c-lang.h"
-#include "exceptions.h"
 #include "typeprint.h"
 
-#include <string.h>
-
 static struct cp_abi_ops gnu_v3_abi_ops;
 
 /* A gdbarch key for std::type_info, in the event that it can't be
@@ -1315,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
This page took 0.024594 seconds and 4 git commands to generate.