Skip to content

Commit

Permalink
Merge pull request #4203 from 9rnsr/fix13835
Browse files Browse the repository at this point in the history
Issue 13835 - ICE in interpret.c:736 - Issue with static variables
  • Loading branch information
yebblies committed Dec 9, 2014
2 parents 8ff302a + becd62f commit 16fcb2d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/interpret.c
Expand Up @@ -5965,13 +5965,10 @@ class Interpreter : public Visitor
StructLiteralExp *se = (StructLiteralExp *)ex;
dinteger_t offset = ae->e2->toInteger();
result = se->getField(e->type, (unsigned)offset);
if (!result)
result = CTFEExp::cantexp;
return;
if (result)
return;
}
}
result = Ptr(e->type, e->e1).copy();
return;
}

// Check for .classinfo, which is lowered in the semantic pass into **(class).
Expand Down
22 changes: 22 additions & 0 deletions test/fail_compilation/ice13835.d
@@ -0,0 +1,22 @@
/*
TEST_OUPUT:
---
fail_compilation/ice13835.d(15): Error: value of 'this' is not known at compile time
fail_compilation/ice13835.d(21): Error: template instance ice13835.Foo!int error instantiating
---
*/

class Foo(T)
{
private T* _data;

final private void siftUp(int position) nothrow
{
static T crash = *(this._data + position);
}
}

void main()
{
auto heap = new Foo!(int);
}

0 comments on commit 16fcb2d

Please sign in to comment.