On Wednesday, 17 December 2025 at 14:29:21 UTC, Adam D. Ruppe wrote:
On Tuesday, 16 December 2025 at 23:25:18 UTC, DLearner wrote:
1. Any proposals to mark a function as CTFE only?

In OpenD you can

```
string genStuff(string val) {
        if(__ctfe) {
                return val ~ ";";
        } else {
                assert(0);
        }
}
```

That is, wrap the whole function in `if(__ctfe) {}` and it passes this test since the gc use is now provably only in ctfe.

I don't know about the other dmd release but it might work there too, worth trying it.

This idea worked with DMD64 D Compiler v2.111.0.

In particular, it worked even when the equivalent of 'genStuff()' was defined in a different module and imported into main.

Thanks!
  • Do string mixins... DLearner via Digitalmars-d-learn
    • Re: Do stri... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
      • Re: Do ... DLearner via Digitalmars-d-learn
        • Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
          • ... DLearner via Digitalmars-d-learn
            • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
              • ... DLearner via Digitalmars-d-learn
        • Re:... Adam D. Ruppe via Digitalmars-d-learn
          • ... DLearner via Digitalmars-d-learn
    • Re: Do stri... Kapendev via Digitalmars-d-learn

Reply via email to