Opened 10 years ago
Closed 10 years ago
#2889 closed defect (fixed)
Function pointers loose their default values
Reported by: | Per Östlund | Owned by: | Martin Sjölund |
---|---|---|---|
Priority: | normal | Milestone: | 1.9.1 |
Component: | MetaModelica | Version: | trunk |
Keywords: | Cc: |
Description
Evaluating the test function below causes a segfault:
function FuncID11<IT1, OT1> input FuncType inFunc; output FuncType outFunc := inFunc; partial function FuncType input IT1 inArg1; output OT1 outArg1; end FuncType; end FuncID11; function f1 input Real x; input Real y; output Real z := x + y; end f1; function test partial function pf input Real x; output Real z; end pf; output Real x; protected pf mypf; algorithm mypf := FuncID11(function f1(y = 3)); x := mypf(2); end test;
The reason is that outFunc in FuncID11 becomes a SimCode.FUNCTION_PTR, which doesn't have a field to store the default value in. A workaround in this case is to do the assignment in an algorithm section, but this obviously doesn't work for input default arguments.
Change History (4)
comment:1 by , 10 years ago
Milestone: | Bootstrapping → 1.9.1 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:2 by , 10 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
The test added to hudson seems to seg.fault. Worked fine on my machine. Will investigate.
Note:
See TracTickets
for help on using tickets.
Fixed in r22763.