string literal as const var parameter

Waldek Hebisch hebisch at math.uni.wroc.pl
Thu Jun 28 19:58:47 CEST 2012


The attached patch should fix the problem.

-- 
                              Waldek Hebisch
hebisch at math.uni.wroc.pl 
-------------- next part --------------
diff --git a/p/typecheck.c b/p/typecheck.c
index c57e1c7..c0744e8 100644
--- a/p/typecheck.c
+++ b/p/typecheck.c
@@ -1037,8 +1037,15 @@ convert_arg1 (tree * tp, tree val, struct argument_error_context * errc,
                 type = TREE_TYPE (val);
               else if (!varparm)
                 type = build_pascal_string_schema (PASCAL_STRING_LENGTH (val));
-              if (is_readonly != TYPE_READONLY (type) || is_volatile != TYPE_VOLATILE (type))
-                type = p_build_type_variant (type, is_readonly, is_volatile);
+              if (is_readonly != TYPE_READONLY (type)
+                  || is_volatile != TYPE_VOLATILE (type)
+                  || PASCAL_TYPE_VAL_REF_PARM (type) != val_ref_parm)
+                {
+                  type = build_type_copy (type);
+                  TYPE_READONLY (type) = is_readonly;
+                  TYPE_VOLATILE (type) = is_volatile;
+                  PASCAL_TYPE_VAL_REF_PARM (type) = val_ref_parm;
+                }
               if (varparm && TREE_CODE (type) != REFERENCE_TYPE)
                 {
                   type = build_type_copy (build_reference_type (type));


More information about the Gpc mailing list