Skip to content

Default values for fixed size arrays #109

Open
@dddejan

Description

@dddejan
contract Test {
    struct S {
        int x;
    }
    function test() {
        S[2][3] memory a;
        assert(a.length == 3);
        assert(a[0].length == 2);
        assert(a[1].length == 2);
        assert(a[0][0].x == 0);
        assert(a[1][0].x == 0);
        assert(a[2][0].x == 0);
        assert(a[0][1].x == 0);
        assert(a[1][1].x == 0);
        assert(a[2][1].x == 0);
    }
}

Currently we get:

solc-verify.py Test.sol
Test::test: ERROR
 - Test.sol:7:9: Assertion might not hold.
Test::[implicit_constructor]: OK

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions