Skip to content

Commit 37aacfc

Browse files
author
Walter Bright
committed
bugzilla 5131 Segfault(expression.c) opAssign and associative arrays (AA) are broken for types != this
1 parent 8b91a00 commit 37aacfc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/expression.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8971,9 +8971,10 @@ Expression *AssignExp::semantic(Scope *sc)
89718971
{
89728972
// Deal with AAs (Bugzilla 2451)
89738973
// Rewrite as:
8974-
// e1 = (typeof(e2) tmp = void, tmp = e2, tmp);
8974+
// e1 = (typeof(aa.value) tmp = void, tmp = e2, tmp);
8975+
Type * aaValueType = ((TypeAArray *)((IndexExp*)e1)->e1->type->toBasetype())->next;
89758976
Identifier *id = Lexer::uniqueId("__aatmp");
8976-
VarDeclaration *v = new VarDeclaration(loc, e2->type,
8977+
VarDeclaration *v = new VarDeclaration(loc, aaValueType,
89778978
id, new VoidInitializer(NULL));
89788979
v->storage_class |= STCctfe;
89798980

0 commit comments

Comments
 (0)