Skip to content

Commit

Permalink
Merge pull request #2073 from 9rnsr/fix10160
Browse files Browse the repository at this point in the history
[REG2.063a] Issue 10160 - No line number "cannot modify struct ... with immutable members"
  • Loading branch information
WalterBright committed May 24, 2013
1 parent de23a43 commit e23c785
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/expression.c
Original file line number Diff line number Diff line change
Expand Up @@ -11057,7 +11057,7 @@ Expression *AssignExp::semantic(Scope *sc)
if (e1->op != TOKvar)
e1 = e1->optimize(WANTvalue);

if (op != TOKconstruct)
if (op == TOKassign)
e1 = e1->modifiableLvalue(sc, e1old);
}

Expand Down
14 changes: 14 additions & 0 deletions test/runnable/sdtor.d
Original file line number Diff line number Diff line change
Expand Up @@ -2807,6 +2807,20 @@ void test10055b()
}
}

/**********************************/
// 10160

struct S10160 { this(this) {} }

struct X10160a { S10160 s; const int x; }
struct X10160b { S10160 s; const int x = 1; }

void test10160()
{
X10160a xa;
X10160b xb;
}

/**********************************/

int main()
Expand Down

0 comments on commit e23c785

Please sign in to comment.