Skip to content

[BUG] Cannot initialise container in the constructor under certain conditions #679

@guybrush77

Description

@guybrush77

Describe the bug

Cannot initialise container in the constructor under certain conditions.

To Reproduce

Consider this code:

foo: type = {
    m: std::map<int, int>;
    operator=: (out this, bar: int) = { m = ( std::pair(1, 2), std::pair(3, 4) ); }
}

main: () = {
    f := foo(5);
}

I get this error using MSVC:

repro.cpp(7): error C2679: binary '=': no operator found which takes a right-hand operand of type 'std::pair<int,int>' (or there is no acceptable conversion)

If I remove the bar parameter then it works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions