pragma(__ctfe)
Bruce Carneal
bcarneal at gmail.com
Thu Sep 28 11:05:07 UTC 2023
On Thursday, 28 September 2023 at 06:04:51 UTC, Richard (Rikki)
Andrew Cattermole wrote:
> On 28/09/2023 6:04 PM, ryuukk_ wrote:
>> Why couldn't the compiler already guess this?
>>
>> To me a simple static analysis would be enough and better, or
>> is it too slow? time saved not generating what's not used
>> could offset time spent on the analysis?
>
> When you do multi-step builds (which are common), this would
> result in link failures. Since you don't have all the code, you
> can't do any analysis without failures being possible. It would
> make druntime and Phobos fail to link correctly with a giant
> list of missing symbols.
Correct. If the function is intended to actually be ctfe only,
as marked, and a reference somehow gets emitted to be linked
against, then you will see a link time error.
More information about the Digitalmars-d
mailing list