Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/fail216.d

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail216.d(16): Error: expression `foo()` is `void` and has no value
5 fail_compilation/fail216.d(14): Error: function `fail216.bar` has no `return` statement, but is expected to return a value of type `int`
6 fail_compilation/fail216.d(19): called from here: `bar()`
7 ---
8 */
9
10 // https://issues.dlang.org/show_bug.cgi?id=1744
11 // CTFE: crash on assigning void-returning function to variable
12 void foo() {}
13
14 int bar()
15 {
16 int x = foo();
17 }
18
19 const y = bar();