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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 21 00:04:46 UTC 2018


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

--- Comment #3 from Nicholas Wilson <iamthewilsonator at hotmail.com> ---
(In reply to Martin Nowak from comment #2)
> cat > bug.d << CODE
> import std.format;
> import std.stdio;
> void main()
> {
>     enum s = "%1$s,%2$s".format("foo","bar");
>     writeln(s);
> }
> CODE
> dmd -c -betterC bug.d
> ----
> /home/dawg/dlang/dmd-2.078.0/linux/bin64/../../src/phobos/std/range/
> primitives.d(405): Error: static assert  "Cannot put a const(char)[] into a
> Appender!string."
> /home/dawg/dlang/dmd-2.078.0/linux/bin64/../../src/phobos/std/format.d(1172):
> instantiated from here: put!(Appender!string, const(char)[])
> /home/dawg/dlang/dmd-2.078.0/linux/bin64/../../src/phobos/std/format.d(473):
> instantiated from here: writeUpToNextSpec!(Appender!string)
> /home/dawg/dlang/dmd-2.078.0/linux/bin64/../../src/phobos/std/format.d(5831):
> instantiated from here: formattedWrite!(Appender!string, char, string,
> string)
> /home/dawg/Code/D/bug.d(5):        instantiated from here: format!(char,
> string, string)
> ----
> 
> Confirmed that this stopped to work with 2.078.0, the error looks rather
> weird, as betterC shouldn't change types.
> 

Indeed that is issue 18101 which was fixed to check typeinfo, but now also
fails at compile time.

> Also indeed with 2.079.0-beta.1 the error message is now about using
> TypeInfo.
> ----
> /home/dawg/dlang/dmd-2.079.0-beta.1/linux/bin64/../../src/phobos/std/array.
> d(2889): Error: TypeInfo cannot be used with -betterC
> ----
> 
> The test case compiles fine with 2.077.1.

That sounds about the right timeframe.

--


More information about the Digitalmars-d-bugs mailing list