digitalmars.D.learn - casting as char at CT fail
- bioinfornatics (8/8) Nov 26 2013 Hi,
- Shammah Chancellor (8/18) Nov 26 2013 String at compile time seem to be represented as dchar. Also, the
- bioinfornatics (14/33) Nov 26 2013 ldc2 fail too but error message is better, i think.
- Philippe Sigaud (1/1) Nov 26 2013 Does std.conv.to have a better behavior?
- bioinfornatics (4/5) Nov 27 2013 http://www.dpaste.dzfl.pl/6a5d8c72
- Shammah Chancellor (3/40) Nov 27 2013 The cast is unnecessary just do the assignment using dchars. Even
- Kenji Hara (6/14) Nov 27 2013 I found two compiler issues:
- Shammah Chancellor (13/31) Nov 28 2013 Kenji you are awesome!
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
Nov 26 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 everyoneString 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?
Nov 26 2013
On Wednesday, 27 November 2013 at 01:22:07 UTC, Shammah Chancellor wrote:On 2013-11-26 23:31:14 +0000, bioinfornatics said: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)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 everyoneString 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?
Nov 26 2013
Does std.conv.to have a better behavior?
Nov 26 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
Nov 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:The cast is unnecessary just do the assignment using dchars. Even with that fixed though, there is annother problem as seen in my dpaste.On 2013-11-26 23:31:14 +0000, bioinfornatics said: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)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 everyoneString 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?
Nov 27 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 everyoneI 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
Nov 27 2013
On 2013-11-28 03:40:25 +0000, Kenji Hara said:On Tuesday, 26 November 2013 at 23:31:16 UTC, bioinfornatics wrote: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!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 everyoneI 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
Nov 28 2013