aboutsummaryrefslogtreecommitdiff
path: root/gdb/valops.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-12-06 21:41:07 +0000
committerTom Tromey <tromey@redhat.com>2012-12-06 21:41:07 +0000
commit0ba2eb0fb60577c618e188ff4a879a721199395d (patch)
tree64ed66ac6c8de43429b99ff96d72c6e0ca88d5e1 /gdb/valops.c
parent731145cb171b848d564a696e81153166524eb35a (diff)
downloadgdb-0ba2eb0fb60577c618e188ff4a879a721199395d.zip
gdb-0ba2eb0fb60577c618e188ff4a879a721199395d.tar.gz
gdb-0ba2eb0fb60577c618e188ff4a879a721199395d.tar.bz2
2012-12-06 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com> * valops.c (value_cast): Move TYPE_CODE_VOID case earlier. testsuite * gdb.base/exprs.exp: Add tests for cast to void.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r--gdb/valops.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gdb/valops.c b/gdb/valops.c
index 1dd2579..372f118 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -569,6 +569,10 @@ value_cast (struct type *type, struct value *arg2)
}
return val;
}
+ else if (code1 == TYPE_CODE_VOID)
+ {
+ return value_zero (type, not_lval);
+ }
else if (TYPE_LENGTH (type) == TYPE_LENGTH (type2))
{
if (code1 == TYPE_CODE_PTR && code2 == TYPE_CODE_PTR)
@@ -582,10 +586,6 @@ value_cast (struct type *type, struct value *arg2)
}
else if (VALUE_LVAL (arg2) == lval_memory)
return value_at_lazy (type, value_address (arg2));
- else if (code1 == TYPE_CODE_VOID)
- {
- return value_zero (type, not_lval);
- }
else
{
error (_("Invalid cast."));