[Issue 18472] [Reg 2.078] betterC: cannot use format at compile time.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 16 10:47:49 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18472

--- Comment #10 from Mike Franklin <slavo5150 at yahoo.com> ---
PR 8173 seems to take care of the case...

module betterc;
enum b = typeid(size_t) is typeid(uint)

... but still fails for ...

import std.format;
import std.stdio;
void main()
{
    enum s = "%1$s,%2$s".format("foo","bar");
    writeln(s);
}

... with the same TypeInfo error.

However, if I comment out the TypeInfo check altogether, the `format` test case
fails with...

phobos/std/range/primitives.d(405): Error: static assert:  "Cannot put a
const(char)[] into a Appender!string."
phobos/std/format.d(1184):        instantiated from here: put!(Appender!string,
const(char)[])
/phobos/std/format.d(473):        instantiated from here:
writeUpToNextSpec!(Appender!string)
phobos/std/format.d(6168):        instantiated from here:
formattedWrite!(Appender!string, char, string, string)
main.d(5):        instantiated from here: format!(char, string, string)

I'm wondering if there was another change to Phobos around the same time frame
was the TypeInfo change that prevents the `format` expression from evaluating
at compile-time.

--


More information about the Digitalmars-d-bugs mailing list