Thread overview
casting as char at CT fail
Nov 26, 2013
bioinfornatics
Nov 27, 2013
Shammah Chancellor
Nov 27, 2013
bioinfornatics
Nov 27, 2013
Philippe Sigaud
Nov 27, 2013
bioinfornatics
Nov 27, 2013
Shammah Chancellor
Nov 28, 2013
Kenji Hara
Nov 28, 2013
Shammah Chancellor
November 26, 2013
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
November 27, 2013
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?

November 27, 2013
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)
November 27, 2013
Does std.conv.to have a better behavior?
November 27, 2013
On Wednesday, 27 November 2013 at 06:34:27 UTC, Philippe Sigaud wrote:
> Does std.conv.to have a better behavior?

http://www.dpaste.dzfl.pl/6a5d8c72

it segfault
November 27, 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.

November 28, 2013
On Tuesday, 26 November 2013 at 23:31:16 UTC, bioinfornatics wrote:
> 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

I found two compiler issues:

https://d.puremagic.com/issues/show_bug.cgi?id=11627
https://d.puremagic.com/issues/show_bug.cgi?id=11629

Kenji Hara
November 28, 2013
On 2013-11-28 03:40:25 +0000, Kenji Hara said:

> On Tuesday, 26 November 2013 at 23:31:16 UTC, bioinfornatics wrote:
>> 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
> 
> I found two compiler issues:
> 
> https://d.puremagic.com/issues/show_bug.cgi?id=11627
> https://d.puremagic.com/issues/show_bug.cgi?id=11629
> 
> Kenji Hara

Kenji you are awesome!

Also,  I had got his code working to a point: http://www.dpaste.dzfl.pl/985a2f42  and got another compiler bug.

/opt/compilers/dmd2/include/std/range.d(4220): Error: Internal Compiler Error: CTFE literal Tuple(void, void)._expand_field_0
dmd: ctfeexpr.c:359: Expression* copyLiteral(Expression*): Assertion `0' failed.
Seems to happen at the end while trying to instantiate the enum.

I am having trouble turning it into a reduced test case.  Can't find the source of the problem.   Here's the full snippet: http://www.dpaste.dzfl.pl/fork/985a2f42

Thanks for looking into this!