Stream: t-compiler/const-eval

Topic: tuple-structs

Matthew Jasper (Oct 18 2018 at 20:55, on Zulip):

Is there any reason why tuple struct constructors aren't treated as const fns or was this overlooked?

const fn f() -> i32 { 0 }
struct B();

const R: i32 = (*&f)(); // OK
const S: B = (*&B)(); // ERROR
RalfJ (Oct 19 2018 at 06:14, on Zulip):

@Matthew Jasper seems reasonable that we could make them const fn, I think. What about enum constructors?

oli (Oct 19 2018 at 07:16, on Zulip):

huh... that seems like a bug, that should definitely work, considering that B() works. I think the issue is that our function call code explicitly checks for calls to the tuple struct constructor instead of just checking the zst type. const T: B = (B, B).1(); also does not work

Last update: Apr 03 2020 at 17:50UTC