Inconsistent behaviour static assert directly or via mixin?
DLearner
bmqazwsx123 at gmail.com
Mon Mar 23 18:06:35 UTC 2026
Consider:
```
void main() {
string Foo() {
if (__ctfe) {
return `static assert(false, "Indirect");`;
} else {
return ``;
}
}
// static assert(false, "Direct");
mixin(Foo());
}
```
If run, produces 'Indirect' message _and nothing else_.
Now remove the '//', get 'Direct' message _and code dump_.
Inconsistent behaviour?
More information about the Digitalmars-d-learn
mailing list