summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/runnable/testassert_debug.d
blob: 8817a96c547d9db38cc4554e55f4f09aee1b796d (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
/*
https://issues.dlang.org/show_bug.cgi?id=21598

REQUIRED_ARGS: -checkaction=context -debug
PERMUTE_ARGS:
*/

void main()
{
	bool caught;
	try
		assert(foo(1));
	catch (Throwable)
		caught = true;

	assert(caught);
	assert(counter == 1);
}

__gshared int counter;

int foo(int i) pure nothrow
{
	debug counter++;
	return i - 1;
}