summaryrefslogtreecommitdiff
path: root/tests/control-flow/bug736774-2.vala
blob: a7d983f96100474a3ec1ccf3c906888987291cbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
int success = 0;

[Compact]
[Immutable]
[CCode (free_function = "vstring_destroy")]
public class vstring : string {
	public vstring (string s);

	[DestroysInstance]
	public void destroy () {
		free (this);
		success++;
	}
}

vstring may_fail () throws GLib.Error {
	vstring result = (vstring) "test".dup ();
	return (owned) result;
}

void main () {
	try {
		print (_("%s\n"), may_fail ());
	} catch {
	}

	assert (success == 1);
}