static immutable and lambdas inside struct or class. Is that bug or not?

Uranuz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 14 07:27:45 PDT 2016


Greatings!
I need help with these lines bellow. I don't understand why it 
doesn't compile. Is it bug somewhere in Phobos or compiler? Or 
just I wrote smth wrong?
//---------
struct A
{
	import std.algorithm: map;
	import std.array: array;
	import std.typecons: tuple;
	
	
	static immutable aaa = [
		tuple("1", "one"),
		tuple("2", "two"),
		tuple("3", "three")
	];
	
	static immutable bbb = aaa.map!( a => a[0] ).array;
	
}

void main()
{
	A a = A();
}

//---------

Compilation output:
/opt/compilers/dmd2/include/std/algorithm/iteration.d(455): 
Error: this.__lambda6 has no value

You could test it here: https://dpaste.dzfl.pl/67a8cda8f2a8


More information about the Digitalmars-d-learn mailing list