diff options
author | Tom Tromey <tromey@redhat.com> | 2012-12-06 21:41:01 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2012-12-06 21:41:01 +0000 |
commit | e24240d23f4287258138f7ff85d8c4750d4b4745 (patch) | |
tree | 014a21e0a0da09bc56321419fd8ade4fbc9e6742 /gdb/valops.c | |
parent | c922315294a657e7cd33568b3f7210937abed043 (diff) | |
download | gdb-e24240d23f4287258138f7ff85d8c4750d4b4745.tar.gz |
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.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gdb/valops.c b/gdb/valops.c index 1dd25799bfc..372f1186eeb 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.")); |