casting as char at CT fail

Shammah Chancellor anonymous at coward.com
Wed Nov 27 03:49:35 PST 2013


On 2013-11-27 06:06:49 +0000, bioinfornatics said:

> On Wednesday, 27 November 2013 at 01:22:07 UTC, Shammah Chancellor wrote:
>> On 2013-11-26 23:31:14 +0000, bioinfornatics said:
>> 
>>> Hi,
>>> this time i have so many question about CT …
>>> iws and ibuclaw help me for this.
>>> 
>>> I stuck currently about a cast at CT -> http://www.dpaste.dzfl.pl/1a28a22c
>>> 
>>> it seem this should works but not…
>>> So if you confirm maybe a report is needed
>>> 
>>> thanks to everyone
>> 
>> 
>> String at compile time seem to be represented as dchar.   Also, the 
>> loop on bitsPerChar won't work at compile time right now.
>> I think 	 maskTmp = cast(T)((1 << bitsPerChar) - 1);
>> does the same thing though.
>> 
>> http://www.dpaste.dzfl.pl/985a2f42
>> 
>> Fails with some weird internal DMD error now though while trying to 
>> instantiate the enum.   Maybe time for a bug report?
> 
> ldc2 fail too but error message is better, i think.
> 
> $ ldc2 BaseTest2.d
> /usr/include/d/std/range.d(4171): Error: pointer cast from 
> immutable(dchar)* to dchar* is not supported at compile time
> BaseTest2.d(56):        called from here: __r11.front()
> BaseTest2.d(99):        called from here: Base(cast(ubyte)0u, null, 
> cast(ubyte)0u, cast(ubyte)0u, null, null).this(cast(ubyte)4u, "ACGT", 
> [cast(ubyte)0u, cast(ubyte)1u, cast(ubyte)2u, cast(ubyte)3u])
> BaseTest2.d(101): Error: function BaseTest2.Base!(ubyte, 
> dchar).Base.encode (const(immutable(dchar)[]) word) const is not 
> callable using argument types (string)

The cast is unnecessary just do the assignment using dchars.   Even 
with that fixed though, there is annother problem as seen in my dpaste.



More information about the Digitalmars-d-learn mailing list