decl.c (gnat_to_gnu_entity): Replace pointer types with references ones for functions...
authorPierre-Marie de Rodat <derodat@adacore.com>
Mon, 1 Jun 2015 08:49:46 +0000 (08:49 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 1 Jun 2015 08:49:46 +0000 (08:49 +0000)
* gcc-interface/decl.c (gnat_to_gnu_entity): Replace pointer types with
references ones for functions that return references.

From-SVN: r223920

gcc/ada/ChangeLog
gcc/ada/gcc-interface/decl.c

index fe91cc4..7c03f7e 100644 (file)
@@ -1,3 +1,8 @@
+2015-06-01  Pierre-Marie de Rodat  <derodat@adacore.com>
+
+       * gcc-interface/decl.c (gnat_to_gnu_entity): Replace pointer types with
+       references ones for functions that return references.
+
 2015-06-01  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Incomplete_Type>: For a
index 35930e0..dd2b06f 100644 (file)
@@ -4198,7 +4198,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
               type the pointer type and make a note of that.  */
            if (Returns_By_Ref (gnat_entity))
              {
-               gnu_return_type = build_pointer_type (gnu_return_type);
+               gnu_return_type = build_reference_type (gnu_return_type);
                return_by_direct_ref_p = true;
              }
 
@@ -4216,7 +4216,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
               the actual return type is the pointer type.  */
            else if (Requires_Transient_Scope (gnat_return_type))
              {
-               gnu_return_type = build_pointer_type (gnu_return_type);
+               gnu_return_type = build_reference_type (gnu_return_type);
                return_unconstrained_p = true;
              }