diff --git a/compiler2/Code.cc b/compiler2/Code.cc
index c7bc59d5e6b4df53d03dbf48a5aded1da4b28bf4..46a5aa69bb697c656886b9e505352b7da7c0624f 100644
--- a/compiler2/Code.cc
+++ b/compiler2/Code.cc
@@ -182,6 +182,7 @@ namespace Common {
     cdef->def = NULL;
     //cdef->cdef = NULL;
     cdef->init = NULL;
+    cdef->post = NULL;
   }
 
   void Code::merge_cdef(output_struct *dest, const_def *cdef)
@@ -189,6 +190,7 @@ namespace Common {
     dest->header.global_vars = mputstr(dest->header.global_vars, cdef->decl);
     dest->source.global_vars = mputstr(dest->source.global_vars, cdef->def);
     dest->functions.pre_init = mputstr(dest->functions.pre_init, cdef->init);
+    dest->functions.post_init = mputstr(dest->functions.post_init, cdef->post);
   }
 
   void Code::free_cdef(const_def *cdef)
@@ -197,6 +199,7 @@ namespace Common {
     Free(cdef->def);
     //Free(cdef->cdef);
     Free(cdef->init);
+    Free(cdef->post);
   }
 
   void Code::init_expr(expression_struct *expr)
diff --git a/compiler2/ttcn3/AST_ttcn3.cc b/compiler2/ttcn3/AST_ttcn3.cc
index 3139562516fb2dfb06f4d88207115d61ffa34119..a860ed078b1991c0dcadd57b88d9aae29eee4366 100644
--- a/compiler2/ttcn3/AST_ttcn3.cc
+++ b/compiler2/ttcn3/AST_ttcn3.cc
@@ -3630,7 +3630,7 @@ namespace Ttcn {
       break;
     default:
       value_under_check = true;
-      type->chk_this_value(value, 0, Type::EXPECTED_CONSTANT, WARNING_FOR_INCOMPLETE,
+        type->chk_this_value(value, 0, Type::EXPECTED_STATIC_VALUE, WARNING_FOR_INCOMPLETE,
         OMIT_NOT_ALLOWED, SUB_CHK, has_implicit_omit_attr());
       value_under_check = false;
       erroneous_attrs = chk_erroneous_attr(w_attrib_path, type, get_my_scope(),
@@ -3688,9 +3688,15 @@ namespace Ttcn {
     const_def cdef;
     Code::init_cdef(&cdef);
     type->generate_code_object(&cdef, value);
+    if (value->is_unfoldable()) {
+    cdef.post = update_location_object(cdef.post);
+    cdef.post = value->generate_code_init(cdef.post,
+      value->get_lhs_name().c_str());
+    } else {
     cdef.init = update_location_object(cdef.init);
     cdef.init = value->generate_code_init(cdef.init,
       value->get_lhs_name().c_str());
+    }
     Code::merge_cdef(target, &cdef);
     Code::free_cdef(&cdef);
   }
diff --git a/compiler2/ttcn3/compiler.h b/compiler2/ttcn3/compiler.h
index f09eb99e8056bda51fb78826d837aba72b44ff22..6498fd5ac4d982556c11f4d8a2d4984530eb002c 100644
--- a/compiler2/ttcn3/compiler.h
+++ b/compiler2/ttcn3/compiler.h
@@ -96,6 +96,7 @@ extern "C" {
     char *def;
     /* char *cdef; */
     char *init;
+    char *post;
   } const_def;
 
   /* Commonly used functions and variables */