Bug 8620 – Possible circular reference

Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2012-09-04T08:17:00Z
Last change time
2012-09-04T23:07:19Z
Assigned to
nobody
Creator
moonburntm

Comments

Comment #0 by moonburntm — 2012-09-04T08:17:18Z
---code import std.stdio; struct itemType { @property double value() { return value; } this(double value) { this.itemValue = value; } private: double itemValue; } void main() { itemType item = itemType(0.05); writeln(item.value); //this line fails } --- ---compile dmd code.d //Works fine --- ---run code.exe //Segfault --- Surely, this shouldn't compile, as the property is either trying to return itself or it's somehow thinking there is a value variable which doesn't exist.
Comment #1 by bugzilla — 2012-09-04T23:07:19Z
There's no way the compiler can detect, in the general case, infinite recursion at runtime.