[dmd-beta] dmd 1.062 and 2.047 beta

Don Clugston dclugston at googlemail.com
Thu Jun 10 08:17:27 PDT 2010


On 10 June 2010 17:14, Don Clugston <dclugston at googlemail.com> wrote:
> On 10 June 2010 09:07, Rainer Schuetze <r.sagitario at gmx.de> wrote:
>> hi,
>>
>> there seems to be a regression regarding compile time evaluation of
>> startsWith:
>>
>> import std.string;
>>
>> const bool ok = startsWith("ab", 'a');
>> const bool fails = startsWith("ab", "a");
>>
>> produces
>> c:\l\dmd2\windows\bin\..\..\src\phobos\std\functional.d(176): Error: static
>> assert  "Bad binary function q{a == b}. You need to use a valid D expression
>> using symbols a of type dchar and b of type string."
>> c:\l\dmd2\windows\bin\..\..\src\phobos\std\functional.d(179):
>>  instantiated from here: Body!(dchar,string)
>> c:\l\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1981):
>>  instantiated from here: result!(dchar,string)
>>
>> This worked for me in 2.046.
>
> This seems to be a Phobos regression, not a compiler regression. I
> slightly reduced this to:
>
> import std.algorithm : startsWith;
>
> const bool fails = startsWith("ab", "a");
>
> Copying the 2.047 implementation of startsWith into 2.046
> std.algorithm, generates the same error as DMD 2.047.

And to clarify -- the reason is that the specialisation of startsWith
for ranges of characters, was removed from std.algorithm.


More information about the dmd-beta mailing list