WhileyCompiler icon indicating copy to clipboard operation
WhileyCompiler copied to clipboard

Cannot Dereference Dynamically Sized Type

Open DavePearce opened this issue 5 years ago • 0 comments

For some reason, the following code from Conway.wy generates an error:

   // Apply click to model state
   model::State st = model::click(x,y,*pState)
   // Update state object
   *pState = st

The error reported is:

./src/main.whiley:30: cannot dereference dynamically sized type
   *pState = st
    ^^^^^^

This can be resolved using this:

   pState->cells = st.cells

The issue for me here is that State is not dynamically sized. Specifically, it is defined as:

public type State is {
    bool[] cells,
    uint width,
    uint height
} where |cells| == width * height

So, I'm unsure why it's thinking it is!!

DavePearce avatar Sep 13 '20 23:09 DavePearce