The following still does not work:
---
import std.format;
import std.stdio;
void main()
{
enum s = "%1$s,%2$s".format("foo","bar");
writeln(s);
}
---
now failing with the message:
std/array.d(3418): Error: `TypeInfo` cannot be used with -betterC
The previous report on this, https://issues.dlang.org/show_bug.cgi?id=18472, found a compiler bug preventing it from working, but that bug was fixed. The problem now appears to be that `format` does not have an `if(__ctfe)` path in it.
Comment #1 by bugzilla — 2023-03-01T02:45:07Z
On second thought, it's still another compiler problem. CTFE should still be on when compiling format.
Comment #2 by bugzilla — 2023-03-11T19:26:37Z
The problem is illustrated with:
---
void test()
{
enum s = foo();
}
int foo()
{
new C();
return 1;
}
class C { }
---
While executing foo() at compile time works, even with -betterC, the compiler still tries to generate code for foo(). This produces the error about a reference to TypeInfo.
Comment #3 by robert.schadek — 2024-12-13T19:27:32Z