-
-
Notifications
You must be signed in to change notification settings - Fork 671
Fix Issue 19754 - cast() sometimes yields lvalue, sometimes yields rvalue #9505
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,3 @@ | ||
| /* | ||
| TEST_OUTPUT: | ||
| --- | ||
| fail_compilation/ice14929.d(45): Error: `cast(Node)(*this.current).items[this.index]` is not an lvalue and cannot be modified | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this was casting a |
||
| fail_compilation/ice14929.d(88): Error: template instance `ice14929.HashMap!(ulong, int).HashMap.opBinaryRight!"in"` error instantiating | ||
| fail_compilation/ice14929.d(92): instantiated from here: `HashmapComponentStorage!int` | ||
| fail_compilation/ice14929.d(92): Error: template instance `ice14929.isComponentStorage!(HashmapComponentStorage!int, int)` error instantiating | ||
| fail_compilation/ice14929.d(92): while evaluating: `static assert(isComponentStorage!(HashmapComponentStorage!int, int))` | ||
| --- | ||
| */ | ||
|
|
||
| struct HashMap(K, V) | ||
| { | ||
| V* opBinaryRight(string op)(K key) const if (op == "in") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| void main() | ||
| { | ||
| shared int x; | ||
| (cast() x) = 5; | ||
|
|
||
| const int x1; | ||
| (cast() x1) = 5; | ||
|
|
||
| immutable int x2; | ||
| (cast() x2) = 5; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,12 @@ | ||
| /* | ||
| TEST_OUTPUT: | ||
| --- | ||
| fail_compilation/diag4596.d(15): Error: `this` is not an lvalue and cannot be modified | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The branches of the |
||
| fail_compilation/diag4596.d(16): Error: `1 ? this : this` is not an lvalue and cannot be modified | ||
| fail_compilation/diag4596.d(18): Error: `super` is not an lvalue and cannot be modified | ||
| fail_compilation/diag4596.d(19): Error: `1 ? super : super` is not an lvalue and cannot be modified | ||
| fail_compilation/diag4596.d(17): Error: `this` is not an lvalue and cannot be modified | ||
| fail_compilation/diag4596.d(18): Error: `this` is not an lvalue and cannot be modified | ||
| fail_compilation/diag4596.d(18): Error: `this` is not an lvalue and cannot be modified | ||
| fail_compilation/diag4596.d(20): Error: `super` is not an lvalue and cannot be modified | ||
| fail_compilation/diag4596.d(21): Error: `super` is not an lvalue and cannot be modified | ||
| fail_compilation/diag4596.d(21): Error: `super` is not an lvalue and cannot be modified | ||
| --- | ||
| */ | ||
|
|
||
|
|
||
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.
20011 is caused by the displacement of this IfStatement