stage4/generate_c/generate_c_il.cc
changeset 1016 91bef6704b44
parent 1011 76175defb87b
child 1041 56ebe2a31b5b
--- a/stage4/generate_c/generate_c_il.cc	Thu May 26 14:26:33 2016 +0100
+++ b/stage4/generate_c/generate_c_il.cc	Thu May 26 15:00:20 2016 +0100
@@ -884,8 +884,11 @@
   int fdecl_mutiplicity =  function_symtable.count(symbol->function_name);
   if (fdecl_mutiplicity == 0) ERROR;
 
-  this->implicit_variable_result.accept(*this);
-  s4o.print(" = ");
+  /* when function returns a void, we do not store the value in the default variable! */
+  if (!get_datatype_info_c::is_VOID(symbol->datatype)) {
+    this->implicit_variable_result.accept(*this);
+    s4o.print(" = ");
+  }
     
   if (function_type_prefix != NULL) {
     s4o.print("(");
@@ -1288,8 +1291,11 @@
     /* function being called is NOT overloaded! */
     f_decl = NULL; 
 
-  this->implicit_variable_result.accept(*this);
-  s4o.print(" = ");
+  /* when function returns a void, we do not store the value in the default variable! */
+  if (!get_datatype_info_c::is_VOID(symbol->datatype)) {
+    this->implicit_variable_result.accept(*this);
+    s4o.print(" = ");
+  }
   
   if (function_type_prefix != NULL) {
     s4o.print("(");