Skip to content

assertion failures when declaring native functions which return arrays #394

Open
@YashasSamaga

Description

@YashasSamaga

Issue description:

It turns out the compiler allows explicitly marking functions which return arrays in forward declarations. While the compiler is capable of figuring out the array size of functions which are defined, it cannot do so with native functions since they are not defined in the script. Hence, it is required to explicitly specify the returned array size.

This compiles fine in release build and appears to produce the correct (or at least useful) assembly but fails assertions in the debug build.

Minimal complete verifiable example (MCVE):

native [4]nfunc();
main () {
	nfunc();
}

Workspace Information:

  • Compiler version:
  • Command line arguments provided (or sampctl version):
  • Operating System:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions