Fix bug in inline function calls when using function with undetermined type interface with literals as input
--- a/stage4/generate_c/generate_c_inlinefcall.cc Wed Jun 29 12:28:59 2011 +0200
+++ b/stage4/generate_c/generate_c_inlinefcall.cc Mon Jul 04 15:27:09 2011 +0200
@@ -91,6 +91,12 @@
std::list<FUNCTION_PARAM*>::iterator pt;
fcall_number++;
+ if (search_expression_type->is_literal_integer_type(function_type_prefix)) {
+ function_type_prefix = (symbol_c *)&search_constant_type_c::lint_type_name;
+ }
+ else if (search_expression_type->is_literal_real_type(function_type_prefix)) {
+ function_type_prefix = (symbol_c *)&search_constant_type_c::lreal_type_name;
+ }
s4o.print(s4o.indent_spaces);
s4o.print("inline ");
@@ -107,7 +113,15 @@
PARAM_LIST_ITERATOR() {
if (PARAM_DIRECTION == function_param_iterator_c::direction_in) {
- PARAM_TYPE->accept(*this);
+ if (search_expression_type->is_literal_integer_type(PARAM_TYPE)) {
+ ((symbol_c *)&search_constant_type_c::lint_type_name)->accept(*this);
+ }
+ else if (search_expression_type->is_literal_real_type(PARAM_TYPE)) {
+ ((symbol_c *)&search_constant_type_c::lreal_type_name)->accept(*this);
+ }
+ else {
+ PARAM_TYPE->accept(*this);
+ }
s4o.print(" ");
PARAM_NAME->accept(*this);
s4o.print(",\n" + s4o.indent_spaces);