Fix ptype bug actually exercised in userdef.exp
[deliverable/binutils-gdb.git] / gdb / eval.c
index f4b39cbc2b05f9686898f6a1a564a2a368df7682..d7f80e2d4f545f10b8574384f24254235363e731 100644 (file)
@@ -2929,12 +2929,12 @@ evaluate_subexp_for_address (struct expression *exp, int *pos,
        {
          struct type *type = check_typedef (value_type (x));
 
-         if (VALUE_LVAL (x) == lval_memory || value_must_coerce_to_target (x))
-           return value_zero (lookup_pointer_type (value_type (x)),
-                              not_lval);
-         else if (TYPE_CODE (type) == TYPE_CODE_REF)
+         if (TYPE_CODE (type) == TYPE_CODE_REF)
            return value_zero (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
                               not_lval);
+         else if (VALUE_LVAL (x) == lval_memory || value_must_coerce_to_target (x))
+           return value_zero (lookup_pointer_type (value_type (x)),
+                              not_lval);
          else
            error (_("Attempt to take address of "
                     "value not located in memory."));
This page took 0.025103 seconds and 4 git commands to generate.