diff --git a/gdb/testsuite/gdb.dwarf2/implref.exp b/gdb/testsuite/gdb.dwarf2/implref.exp
new file mode 100644
index 0000000..8599715
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/implref.exp
@@ -0,0 +1,99 @@
+# Copyright 2016 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test C++ references marked with DW_OP_GNU_implicit_pointer.
+
+# TODO: Add more test statements after fixing bug #19893:
+# https://sourceware.org/bugzilla/show_bug.cgi?id=19893.
+
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
+    return 0
+}
+
+# We'll place the output of Dwarf::assemble in implref.S.
+standard_testfile main.c .S
+
+# ${testfile} is now "implref".  srcfile2 is "implref.S".
+set executable ${testfile}
+set asm_file [standard_output_file ${srcfile2}]
+
+# Create the DWARF.  We need a regular variable and a reference to it that'll
+# be marked with DW_OP_GNU_implicit_pointer.
+Dwarf::assemble $asm_file {
+    global srcdir subdir srcfile
+
+    cu { version 3 addr_size 4 } {
+	DW_TAG_compile_unit {
+	    {DW_AT_producer "GNU C++ 4.8.4"}
+	    {DW_AT_language @DW_LANG_C_plus_plus}
+	    {DW_AT_name "implref.c"}
+	} {
+	    declare_labels int_label const_label variable_label ref_label
+
+	    int_label: DW_TAG_base_type {
+		{DW_AT_byte_size 4 DW_FORM_udata}
+		{DW_AT_encoding @DW_ATE_signed}
+		{DW_AT_name "int"}
+	    }
+
+	    ref_label: DW_TAG_reference_type {
+		{DW_AT_byte_size 4 DW_FORM_udata}
+		{DW_AT_type :${int_label}}
+	    }
+
+	    const_label: DW_TAG_const_type {
+	    	{DW_AT_type :${ref_label}}
+	    }
+
+	    DW_TAG_subprogram {
+		{MACRO_AT_func { "main" "${srcdir}/${subdir}/${srcfile}" }}
+		{DW_AT_type :${int_label}}
+		{DW_AT_external 1 DW_FORM_flag}
+	    } {
+		variable_label: DW_TAG_variable {
+		    {DW_AT_name "var"}
+		    {DW_AT_type :${int_label}}
+		    {DW_AT_const_value 42 DW_FORM_udata}
+		}
+
+		DW_TAG_variable {
+		    {DW_AT_name "ref"}
+		    {DW_AT_type :${const_label}}
+		    {DW_AT_location {DW_OP_GNU_implicit_pointer ${variable_label} 0} SPECIAL_expr}
+		}
+	    }
+	}
+    }
+}
+
+if [prepare_for_testing ${testfile}.exp ${executable} "${asm_file} ${srcfile}" {}] {
+    return -1
+}
+
+# DW_OP_GNU_implicit_pointer implementation requires a valid frame.
+if ![runto_main] {
+    return -1
+}
+
+gdb_test "print ref" " = \\(int &\\) <synthetic pointer>" "print ref"
+gdb_test "print &ref" " = \\(int \\*\\) <synthetic pointer>" "print &ref"
+
+# gdb assumes C++ references are implemented as pointers, and print &(&ref)
+# shows us the underlying pointer's address.
+# Since in this case there's no physical pointer, gdb should tell us so.
+gdb_test "print &\(&ref\)" "Attempt to take address of value not located in memory." "print &(&ref)"
diff --git a/gdb/valops.c b/gdb/valops.c
index 5a244a9..40559c2 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1463,11 +1463,19 @@ value_addr (struct value *arg1)
   if (TYPE_CODE (type) == TYPE_CODE_REF)
     {
       /* Copy the value, but change the type from (T&) to (T*).  We
-         keep the same location information, which is efficient, and
-         allows &(&X) to get the location containing the reference.  */
+	 keep the same location information, which is efficient, and
+	 allows &(&X) to get the location containing the reference.
+	 Do the same to its enclosing type for consistency.  */
+      struct type *type_ptr = lookup_pointer_type (TYPE_TARGET_TYPE (type));
+
+      struct type *enclosing_type = check_typedef (value_enclosing_type (arg1));
+      struct type *enclosing_type_ptr =
+	lookup_pointer_type (TYPE_TARGET_TYPE (enclosing_type));
+
       arg2 = value_copy (arg1);
-      deprecated_set_value_type (arg2, 
-				 lookup_pointer_type (TYPE_TARGET_TYPE (type)));
+      deprecated_set_value_type (arg2, type_ptr);
+      set_value_enclosing_type (arg2, enclosing_type_ptr);
+
       return arg2;
     }
   if (TYPE_CODE (type) == TYPE_CODE_FUNC)
