Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
guybrush77 opened this issue Sep 14, 2023 · 1 comment · May be fixed by #680
Open

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

guybrush77 opened this issue Sep 14, 2023 · 1 comment · May be fixed by #680
Labels
bug Something isn't working

Comments

@guybrush77
Copy link

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.

@guybrush77 guybrush77 added the bug Something isn't working label Sep 14, 2023
@JohelEGP
Copy link
Contributor

This was supposed to have been fixed by #487.
The assignment works outside operator=.
But it looks like there's separate logic for emitting operator=.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants