Opened 14 years ago

Last modified 12 years ago

#1525 closed defect

Calling Integer on enumeration type result in C compilation errors — at Initial Version

Reported by: Per Östlund Owned by: Per Östlund
Priority: high Milestone:
Component: Frontend Version:
Keywords: Cc: Per Östlund

Description

The following model:

type E = enumeration(one, two, three);

function fun
  input E e;
  output Boolean b;
algorithm
  if Integer(E) == 1 then
    b := true;
  else
    b := false;
  end if;
end fun;

model m
  Boolean b = fun(E.two);
end m;

gives the error message:

fun.c:28:13: error: invalid operands to binary == (have 'integer_array' and 'long int')

while instantiating the model.

It's not clear to me if Integer(E) is actually valid Modelica or not, see Modelica issue #551. If it's not valid the Integer call in fun should simply be rejected, otherwise better type checking is required.

Change History (0)

Note: See TracTickets for help on using tickets.