Opened 11 years ago

Last modified 11 years ago

#2687 closed defect

Overloading '-' — at Initial Version

Reported by: Martin Sjölund Owned by: somebody
Priority: high Milestone: 1.9.1
Component: Frontend Version: trunk
Keywords: Cc: Mahder Alemseged Gebremedhin, krsta

Description

The following generates the same code for both assignments (wrong for subtraction):

operator record C
  Real r;
  encapsulated operator 'constructor'
    import C;
    function fromReal
      input Real r;
      output C c;
    algorithm
      c.r := r;
    end fromReal;
  end 'constructor';
  encapsulated operator function '+'
    import C;
    input C c1,c2;
    output C c;
  algorithm
    c.r := c1.r + c2.r;
  end '+';
  encapsulated operator function '-'
    import C;
    input C c1,c2;
    output C c;
  algorithm
    c.r := c1.r + c2.r;
  end '-';
end C;

model M
  C c1,c2;
  Real r;
algorithm
  c2 := r - c1;
  c2 := c1 - r;
end M;

Change History (0)

Note: See TracTickets for help on using tickets.