Guard a call to TYPE_TARGET_TYPE in gnuv3_pass_by_reference.

gdb/ChangeLog:

	* gnu-v3-abi.c (gnuv3_pass_by_reference): Call TYPE_TARGET_TYPE
	on the arg type of a constructor only if it is of reference type.

gdb/testsuite/ChangeLog:

	* gdb.cp/non-trivial-retval.cc: Add a test case.
	* gdb.cp/non-trivial-retval.exp: Add a test.
This commit is contained in:
Siva Chandra
2014-10-16 07:14:13 -07:00
parent 68fcca92b7
commit 3433cfa51f
5 changed files with 51 additions and 5 deletions

View File

@@ -1320,13 +1320,15 @@ gnuv3_pass_by_reference (struct type *type)
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)
{
struct type *arg_target_type;
if (TYPE_CODE (arg_type) == TYPE_CODE_REF
&& class_types_same_p (arg_target_type, type))
return 1;
arg_target_type = check_typedef (TYPE_TARGET_TYPE (arg_type));
if (class_types_same_p (arg_target_type, type))
return 1;
}
}
}