summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/fail216.d
blob: eb736e64b94ec8d208fb886baf3eabfa0b4fe209 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
TEST_OUTPUT:
---
fail_compilation/fail216.d(16): Error: expression `foo()` is `void` and has no value
fail_compilation/fail216.d(14): Error: function `fail216.bar` has no `return` statement, but is expected to return a value of type `int`
fail_compilation/fail216.d(19):        called from here: `bar()`
---
*/

// https://issues.dlang.org/show_bug.cgi?id=1744
// CTFE: crash on assigning void-returning function to variable
void foo() {}

int bar()
{
    int x = foo();
}

const y = bar();