-
-
Notifications
You must be signed in to change notification settings - Fork 746
Fix Issue 10879 - std.variant Variant/Algebraic: Cant store static ar… #4204
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
Conversation
|
Thanks for your pull request, @Biotronic! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Some tips to help speed things up:
Bear in mind that large or tricky changes may require multiple rounds of review and revision. Please see CONTRIBUTING.md for more information. Bugzilla references
|
3258c5b to
6e18dce
Compare
std/variant.d
Outdated
| return !tryPutting(null, *cast(TypeInfo*) parm, null); | ||
| case OpID.compare: | ||
| case OpID.equals: | ||
| import std.stdio; |
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.
Debugging leftover?
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.
I have no idea what you're talking about.
|
It could be argued that this bug should be fixed in DMD rather than Phobos, in that 'new T' should work for any T, even something like int[10]. |
|
LGTM though better fix DMD |
|
I made a fix in DMD as well. If dlang/dmd#5688 is accepted, this pull can be ignored. |
can we have one of those "decision blocked" labels? thanks! |
|
Anything new ? Since the dmd pull has stalled, maybe this can be pulled ? |
|
@tramker sorry this got stalled. If you rebase onto the latest version of master I will review it. |
c501deb to
72212e3
Compare
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.
I really wish Github would notify me when a PR I've commented on is rebased.
std/variant.d
Outdated
| v2 = arr; | ||
| assert(v1 == arr); | ||
| assert(v2 == arr); | ||
| foreach (i, e; arr) { |
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.
Please put braces on their own line.
std/variant.d
Outdated
| assert(v1[i] == e); | ||
| assert(v2[i] == e); | ||
| } | ||
| static struct LargeStruct { |
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.
ditto
std/variant.d
Outdated
| { | ||
| static if (is(A a == U[n], U, size_t n)) | ||
| { | ||
| pragma(msg, "A"); |
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.
Please remove this.
std/variant.d
Outdated
| } | ||
| else | ||
| { | ||
| pragma(msg, "B"); |
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.
ditto
std/variant.d
Outdated
| if (target.type.tsize < A.sizeof) | ||
| *cast(A**)&target.store = new A; | ||
| { | ||
| static if (is(A a == U[n], U, size_t n)) |
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.
This can be shortened to is(A == U[n], U, size_t n)) (a is never used).
| static if (is(A a == U[n], U, size_t n)) | ||
| { | ||
| pragma(msg, "A"); | ||
| A* p = cast(A*)(new U[n]).ptr; |
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.
Correct me if I'm wrong, but if A == U[n] then typeof((new U[n]).ptr) is already A* and thus there's no need for this cast.
std/variant.d
Outdated
| { | ||
| auto p = new T(rhs); | ||
| } | ||
| else static if (is(T t == U[n], U, size_t n)) |
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.
See my above comment for line 343.
| } | ||
| else static if (is(T t == U[n], U, size_t n)) | ||
| { | ||
| auto p = cast(T*)(new U[n]).ptr; |
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.
See my above comment for line 346.
andralex
left a comment
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.
thx
std/variant.d
Outdated
| { | ||
| int[100] data; | ||
| } | ||
| LargeStruct l; |
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.
Could you please choose a different name? l looks like 1. Thanks!
|
No problem. I'm sorry for not testing it before I pushed the changes - I'm on vacation and my laptop is resistant to getting phobos to compile. :p |
0ed0cf2 to
f32df71
Compare
…rays > 32(/16) bytes
|
Updated. The auto-tester failure looks like a fluke. CircleCI and Jenkins are red on basically every PR. Since the DMD PR is closed, could we get this thing going again? |
|
I'm not sure what's going on with the testers, but once they're sorted I'll merge this. |
Jenkins: still having a lot of random failures :/ CircleCi: known, but I still haven't had time to dig into this. I restarted Jenkins + deleted the auto-tester job.
Hehe, no please don't wait. Just add auto-merge, it will have a better visibility then. |
And found this PR and restarted CircleCi as it has been fixed: #6099 |
…rays > 32(/16) bytes