semantics.c (finish_non_static_data_member): Preserve dereference in template.
authorJason Merrill <jason@redhat.com>
Fri, 17 Jun 2011 20:07:13 +0000 (16:07 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 17 Jun 2011 20:07:13 +0000 (16:07 -0400)
* semantics.c (finish_non_static_data_member): Preserve dereference
in template.

From-SVN: r175152

gcc/cp/ChangeLog
gcc/cp/semantics.c

index 7d0a799f90a0812fcff918a5634d74b5ad199945..010f1ddaa4f355f0eba658371ffdad6d42c05ae9 100644 (file)
@@ -1,3 +1,8 @@
+2011-06-17  Jason Merrill  <jason@redhat.com>
+
+       * semantics.c (finish_non_static_data_member): Preserve dereference
+       in template.
+
 2011-06-16  Jason Merrill  <jason@redhat.com>
 
        PR c++/44160
index bad7acbb6714c7a8e2941533b99dd4c4fbebe51c..a43662381862b715540732d7c49c9d107fab30dd 100644 (file)
@@ -1557,7 +1557,7 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
       tree type = TREE_TYPE (decl);
 
       if (TREE_CODE (type) == REFERENCE_TYPE)
-       type = TREE_TYPE (type);
+       /* Quals on the object don't matter.  */;
       else
        {
          /* Set the cv qualifiers.  */
@@ -1572,7 +1572,8 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
          type = cp_build_qualified_type (type, quals);
        }
 
-      return build_min (COMPONENT_REF, type, object, decl, NULL_TREE);
+      return (convert_from_reference
+             (build_min (COMPONENT_REF, type, object, decl, NULL_TREE)));
     }
   /* If PROCESSING_TEMPLATE_DECL is nonzero here, then
      QUALIFYING_SCOPE is also non-null.  Wrap this in a SCOPE_REF