-
-
Notifications
You must be signed in to change notification settings - Fork 706
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
std.traits: Adapt unittest to pass with -preview=in
#7609
Conversation
…id constfold With the new -preview=in check, the const-folding seems to be a bit too aggressive when an rvalue is passed, meaning that the check might fail (probably due to the code that initialize the temporary). To avoid this issue, we simply wrap the assignment in a lambda that will not be called, as there is no downside to that change.
Thanks for your pull request, @Geod24! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + phobos#7609" |
CC @wilzbach , this is what motivated dlang/dmd#11635 . As you can see the workaround isn't terrible either. |
} | ||
else | ||
{ | ||
mixin(q{ struct S6 { void opAssign(in ref S5); } }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a mixin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error with -preview=in
is in the parser (where "redundant storage class" checks are).
And yes, I hate it too and I'm having second thoughts, but it was the most consistent place to have it.
Good idea, except implementing it for |
Yeah, I'm well aware of the problem. We unfortunately did similar workarounds in the past, e.g. Lines 7356 to 7362 in 6194b17
|
47ebc1e
to
3a409ca
Compare
3a409ca
to
461f083
Compare
* std.traits: Use delegates within some __traits(compiles) check to avoid constfold With the new -preview=in check, the const-folding seems to be a bit too aggressive when an rvalue is passed, meaning that the check might fail (probably due to the code that initialize the temporary). To avoid this issue, we simply wrap the assignment in a lambda that will not be called, as there is no downside to that change. * std.traits: Adapt unittest to pass with `-preview=in`
I'm using dlang/dmd#11632 as a way to adapt projects.
With this PR, it should pass for Phobos and the documentation tester.
I should probably add it to Buildkite like what Steven did for auto-decoding 🤔