Voldemort structs no longer work?

Walter Bright newshound2 at digitalmars.com
Sat Dec 15 14:48:59 PST 2012


On 12/15/2012 10:36 AM, H. S. Teoh wrote:
> 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

This compiles if the @property is elided.

Definitely a bug.



More information about the Digitalmars-d mailing list