-
Notifications
You must be signed in to change notification settings - Fork 251
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] Braces around assignment's RHS prevents deduction #312
Comments
But that'll construct a |
I agree with @JohelEGP ... the reason I added That way we also won't get the Clang warning, to stay warning-clean. |
Fix pushed... and it still keeps #291 solved. Thanks everyone! |
@hsutter Please remember it is not only about empty initializer. There are also cases like the following: element: type = {
children: std::vector<int> = (1,2,3);
tab : std::vector<int>;
operator=: (out this, t : int ) = {
tab = (3,2,1);
}
} That previously generated: #line 5 "/Users/filipsajdak/dev/execspec/external/tests/bug_assignement_operator_4.cpp2"
element::element(cpp2::in<int> t)
: tab{ 3, 2, 1 }
#line 5 "/Users/filipsajdak/dev/execspec/external/tests/bug_assignement_operator_4.cpp2"
{
}
#line 5 "/Users/filipsajdak/dev/execspec/external/tests/bug_assignement_operator_4.cpp2"
auto element::operator=(cpp2::in<int> t) -> element& {
children = 1, 2, 3;
tab = 3, 2, 1;
return *this;
#line 7 "/Users/filipsajdak/dev/execspec/external/tests/bug_assignement_operator_4.cpp2"
}
|
But I think we can add braces when the initializer is empty or when the initializer was created with parentheses. |
@hsutter, the current implementation generates again: children = 1, 2, 3;
tab = 3, 2, 1; as here: #312 (comment) |
Describe the bug
feff640 added braces around the RHS of assignment in emitted assignment operators. This prevents deduction when the invoked assignment operator is a template, as a braced-init-list has no type.
To Reproduce
Steps to reproduce the behavior:
What happened before feff640.
The text was updated successfully, but these errors were encountered: