Voldemort structs no longer work?

H. S. Teoh hsteoh at quickfur.ath.cx
Sat Dec 15 10:36:52 PST 2012


With latest git dmd:

	auto makeVoldemort(int x) {
		struct Voldemort {
			@property int value() { return x; }
		}
		return Voldemort();
	}
	void main() {
		auto v = makeVoldemort();
		writeln(v.value);
	}

Compile error:

	test.d(3): Error: function test.makeVoldemort.Voldemort.value cannot access frame of function test.makeVoldemort

Changing 'struct' to 'class' works. Is this deliberate, or is it a bug?
It is certainly inconsistent with Walter's article on Voldemort types,
which uses structs as examples.


T

-- 
You have to expect the unexpected. -- RL


More information about the Digitalmars-d mailing list