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
Fix Issue 19954 - ICE: Casting AliasSeq to array and passing to a function #10036
Conversation
Stable? |
Thanks for your pull request and interest in making D better, @JinShil! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "stable + dmd#10036" |
rebased to stable |
test/compilable/test19954.d
Outdated
|
||
void main() | ||
{ | ||
auto a = cast(char[][]) ""; |
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.
Should this really compile? auto a = cast(int[]) 1;
doesn't.
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.
According to this (run "All dmd com"), yes. But I think ""
is more analogous to []
than to 1
, and auto a = cast(int[])[];
compiles.
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.
Ah, a regression. cast(void[][]) []
does compile too, so all good.
Should there be a test that actually casts an |
Yes please add the test with an alias Seq. If that does not pass then you can add this: + if (exp.e1.type.ty == Ttuple)
+ {
+ TupleExp te = exp.e1.isTupleExp();
+ if (te.exps.dim == 1)
+ exp.e1 = (*te.exps)[0];
+ } around line 6650, just after you're sure that exp.e1.type is a thing. |
Yes, good call. It didn't pass.
Thanks, that worked. |
Best viewed without whitespace changes.