Do string mixins work under -betterC?

Adam D. Ruppe destructionator at gmail.com
Wed Dec 17 14:29:21 UTC 2025


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.


More information about the Digitalmars-d-learn mailing list