Opened 7 years ago

#4895 new defect

listArrayLiteral in uniontype constant gives compilation errors

Reported by: Per Östlund Owned by: Martin Sjölund
Priority: high Milestone: Future
Component: MetaModelica Version: v1.13.0-dev-nightly
Keywords: Cc:

Description

Using listArrayLiteral causes incorrect code to be generated in cases such as this:

package P
  uniontype UT1
    record R1
      Integer n;
    end R1;
  end UT1;

  uniontype UT2
    record R2
      array<UT1> ut1;
    end R2;
  end UT2;

  constant UT2 ut2 = UT2.R2(
    listArrayLiteral({})
  );
end P;

function f
  input P.UT2 ut2;
  output array<P.UT1> ut1 = ut2.ut1;
end f;

function test
algorithm
  f(P.ut2);
end test;

This gives the compilation error:

<interactive>:31:21: error: use of undeclared identifier '_P'
  omc_f(threadData, _P._ut2);

Attachments (1)

test.mos (507 bytes ) - added by Per Östlund 7 years ago.

Download all attachments as: .zip

Change History (1)

by Per Östlund, 7 years ago

Attachment: test.mos added
Note: See TracTickets for help on using tickets.