DMD 2.055

Johannes Pfau spam at example.com
Thu Sep 8 02:05:38 PDT 2011


Joel Christensen wrote:
>On 08-Sep-11 8:46 PM, Joel Christensen wrote:
> > I've got this program that does alters strings, but with D 2.055, it
> > comes up with this error:
> >
> > Here is the code, I copied it from my program:
> > http://p.baf.cc/3937
>
>Oops, accidently sent it prematurely.
>
>Here is the error:
>\jpro\dpro2\verseprompt\section.d(249): Error: incompatible types for 
>((__dgliteral1) ? (__dgliteral2)): 'string delegate(string text) pure' 
>and 'string delegate(string text) @system'
>
>- Joelcnz

It's a problem caused by purity and safety inference for delegate
literals.

I assume the problem is in line 22 of the code you posted? As a
workaround, try to explicitly cast the delegates to the same type:

[cast(string delegate(string))(string text) { return toLower(text); }, 
cast(string delegate(string))(string text) { return wipeOutChars(text,subchars); },
cast(string delegate(string))(string text) { return removeSpaces(text); } ]

-- 
Johannes Pfau



More information about the Digitalmars-d-learn mailing list