summaryrefslogtreecommitdiff
path: root/tests/structs/bug694140.vala
blob: 18368a9799ebc6a2f87cc72c59b9829cefb182db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
string[] colors;

[SimpleType]
[CCode (has_type_id = false)]
struct Foo : int {
	public string bar {
		get {
			return colors[(int) this];
		}
		set {
			colors[(int) this] = value;
		}
	}
}

void main () {
	colors = { "black", "red", "green", "blue" };

	Foo foo = 1;
	assert (foo.bar == "red");
	foo.bar = "white";
	assert (foo.bar == "white");
}