On 10 June 2010 17:14, Don Clugston <[email protected]> wrote:
> On 10 June 2010 09:07, Rainer Schuetze <[email protected]> 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.
_______________________________________________
dmd-beta mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-beta

Reply via email to