Hi

Am 2024-10-31 08:22, schrieb Rob Landers:
To be honest, I thought it was a rhetorical question since the example is a runtime error (passing string to a function that takes an array),

That clearly was a typo / copy-paste mistake / whatever you would like to call it.

but on this note, we already know how it should behave: https://3v4l.org/RC6b3 because, as you said, it is captured by value

The context was “can't we just pretend there’s nothing to capture in const-expr contexts”. The example was intended to point out how that will lead to semantic sadness.

In theory, to support this, we would probably need “late binding constants” or constants that are executed just before any userland code is run. Similar to just emulating it yourself: https://3v4l.org/PMY4W

Yes, but see also my new reply to Larry (and the reply to Alex).

Best regards
Tim Düsterhus

Reply via email to