Time for Phobos CTFE-ability unittests...right? RIGHT?

Johann MacDonagh johann.macdonagh..no at spam..gmail.com
Tue Jul 12 16:54:02 PDT 2011


On 7/12/2011 7:35 PM, Trass3r wrote:
> Am 13.07.2011, 01:24 Uhr, schrieb Johann MacDonagh
> <johann.macdonagh..no at spam..gmail.com>:
>
>> On 7/12/2011 7:17 PM, Andrej Mitrovic wrote:
>>> I don't understand what strip() could be doing to break CTFE anyway?
>>
>> I believe a lot of the std.string functionality was modified to use
>> routines in druntime in this latest release. The default sc.ini links
>> to a static druntime lib as opposed to compiling the source. That
>> means CTFE won't have the source for, in strip's example, _aApplycd2
>> (rt/aApply.d in druntime). Fixing this (and adding in support for
>> std.intrinsic) should fix a ton of bugs where a "small" change in
>> Phobos kills CTFE.
>
> That's true. I had several of these "no source available" errors.
>
> Though I think toUpper crashed at:
>
> S toUpper(S)(S s) @trusted pure
> if(isSomeString!S)
> {
> foreach (i, dchar cOuter; s) <---
> {

That's exactly the issue. When the compiler hits a foreach over a string 
that wants to convert its character type to another, it has to insert 
special magic to make that work (UTF decoding, etc...). Clearly this 
stuff shouldn't be in phobos, so it's in druntime. Unfortunately, the 
compiler doesn't have access to druntime source by default.

I'm not sure how it was doing it before. This worked in 2.053.


More information about the Digitalmars-d mailing list