spicy icon indicating copy to clipboard operation
spicy copied to clipboard

Cannot initialize a `const` with the result of a function call

Open bbannier opened this issue 1 year ago • 0 comments

As of spicyc v1.11.0-dev.168 (b8776965e) it seems impossible to initialize a const with the result of a function call,

module foo;

function bar(): uint16 {
    return 4711;
}

# error: use of undeclared identifier 'bar'
# ||     const ::hilti::rt::integer::safe<uint16_t> xs = bar();
# ||                                                     ^
const xs = bar();

We should either allow this, or reject it explicitly.

bbannier avatar May 15 '24 10:05 bbannier