Re: Is this a bug ? (variable _param_0 cannot be read at compile time)

2018-08-08 Thread Simen Kjærås via Digitalmars-d
On Wednesday, 8 August 2018 at 13:10:58 UTC, learnfirst1 wrote: https://run.dlang.io/is/blpkb6 There is no reason the code just work without template, but try put the it into template the variable become into not readable ? Please don't post your issues in multiple forums. This is exactly wh

Is this a bug ? (variable _param_0 cannot be read at compile time)

2018-08-08 Thread learnfirst1 via Digitalmars-d
https://run.dlang.io/is/blpkb6 There is no reason the code just work without template, but try put the it into template the variable become into not readable ?

Re: Is this a bug with __traits(derivedMembers)?

2018-06-12 Thread Steven Schveighoffer via Digitalmars-d
On 6/12/18 4:19 PM, bauss wrote: On Tuesday, 12 June 2018 at 17:24:31 UTC, Basile B. wrote: I don't know if more doc is necessary. The warning is at its right place IMO. If they're reserved the compiler should honestly throw a warning at the very least. People should have to read through th

Re: Is this a bug with __traits(derivedMembers)?

2018-06-12 Thread bauss via Digitalmars-d
On Tuesday, 12 June 2018 at 17:24:31 UTC, Basile B. wrote: On Tuesday, 12 June 2018 at 15:42:50 UTC, Bauss wrote: On Tuesday, 12 June 2018 at 14:37:19 UTC, ag0aep6g wrote: On Tuesday, 12 June 2018 at 13:40:45 UTC, bauss wrote: See the following: https://run.dlang.io/is/uQ21PH (I have tried wi

Re: Is this a bug with __traits(derivedMembers)?

2018-06-12 Thread Basile B. via Digitalmars-d
On Tuesday, 12 June 2018 at 15:42:50 UTC, Bauss wrote: On Tuesday, 12 June 2018 at 14:37:19 UTC, ag0aep6g wrote: On Tuesday, 12 June 2018 at 13:40:45 UTC, bauss wrote: See the following: https://run.dlang.io/is/uQ21PH (I have tried with allMembers too.) It's like it won't pick up the member t

Re: Is this a bug with __traits(derivedMembers)?

2018-06-12 Thread Bauss via Digitalmars-d
On Tuesday, 12 June 2018 at 14:37:19 UTC, ag0aep6g wrote: On Tuesday, 12 June 2018 at 13:40:45 UTC, bauss wrote: See the following: https://run.dlang.io/is/uQ21PH (I have tried with allMembers too.) It's like it won't pick up the member that is added using a mixin at line 22. ``` mixin("uby

Re: Is this a bug with __traits(derivedMembers)?

2018-06-12 Thread ag0aep6g via Digitalmars-d
On Tuesday, 12 June 2018 at 13:40:45 UTC, bauss wrote: See the following: https://run.dlang.io/is/uQ21PH (I have tried with allMembers too.) It's like it won't pick up the member that is added using a mixin at line 22. ``` mixin("ubyte[" ~ to!string(__PADDING_SIZE__) ~ "] __PADDING__" ~ mem

Re: Is this a bug with __traits(derivedMembers)?

2018-06-12 Thread bauss via Digitalmars-d
On Tuesday, 12 June 2018 at 13:40:45 UTC, bauss wrote: See the following: https://run.dlang.io/is/uQ21PH Note: Look at the comments in the code.

Is this a bug with __traits(derivedMembers)?

2018-06-12 Thread bauss via Digitalmars-d
See the following: https://run.dlang.io/is/uQ21PH (I have tried with allMembers too.) It's like it won't pick up the member that is added using a mixin at line 22. ``` mixin("ubyte[" ~ to!string(__PADDING_SIZE__) ~ "] __PADDING__" ~ member ~ ";"); ``` As you can see if you take sizeof fro

Re: Is this a bug? Initializing immutable fixed size arrays

2016-12-12 Thread Bauss via Digitalmars-d
On Monday, 12 December 2016 at 06:43:52 UTC, Shachar Shemesh wrote: The following compiles fine: immutable char[5] array = x"01 02 03 04 05"; [...] This doesn't seem like a bug: immutable ubyte[5] array = x"01 02 03 04 05"; This however does: immutable ubyte[5] array = cast(immutable ubyte

Is this a bug? Initializing immutable fixed size arrays

2016-12-11 Thread Shachar Shemesh via Digitalmars-d
The following compiles fine: immutable char[5] array = x"01 02 03 04 05"; The following doesn't: immutable ubyte[5] array = x"01 02 03 04 05"; which makes sense, but neither does: immutable ubyte[5] array = cast(immutable ubyte []) x"01 02 03 04 05"; playground.d(1): Error: cannot implicitly co

Re: Is this a bug?

2016-12-10 Thread bauss (wtf happend to my name took some old cached title LOL??) via Digitalmars-d
On Saturday, 10 December 2016 at 08:25:49 UTC, Timon Gehr wrote: On 10.12.2016 09:09, Is it possible to store different generic This is intended (but surprising, and IMHO bad) behaviour, as D follows C integral promotion rules. (C# does not.) Mixed signed/unsigned operations first convert both

Re: Is this a bug?

2016-12-10 Thread Timon Gehr via Digitalmars-d
On 10.12.2016 09:24, Is it possible to store different generic types? wrote: On Saturday, 10 December 2016 at 08:21:17 UTC, Stefan Koch wrote: On Saturday, 10 December 2016 at 08:16:48 UTC, Is it possible to store different generic types? wrote: On Saturday, 10 December 2016 at 08:09:00 UTC, Is

Re: Is this a bug?

2016-12-10 Thread Is it possible to store different generic types? via Digitalmars-d
On Saturday, 10 December 2016 at 08:23:06 UTC, Ali Çehreli wrote: On 12/10/2016 12:16 AM, Is it possible to store different generic types? wrote: > Okay the issue seem to be that D casts the left-hand argument to the > same type as the right-hand argument. Seems to be but not true. It's more l

Re: Is this a bug?

2016-12-10 Thread Timon Gehr via Digitalmars-d
On 10.12.2016 09:09, Is it possible to store different generic types? wrote: I'm pretty sure the following code should work, but it doesn't. ``` bool intersect(ptrdiff_t targetX, ptrdiff_t targetY, size_t targetWidth, size_t targetHeight, ptrdiff_t x, ptrdiff_t y, size_t width, size_t height) {

Re: Is this a bug?

2016-12-10 Thread Is it possible to store different generic types? via Digitalmars-d
On Saturday, 10 December 2016 at 08:21:17 UTC, Stefan Koch wrote: On Saturday, 10 December 2016 at 08:16:48 UTC, Is it possible to store different generic types? wrote: On Saturday, 10 December 2016 at 08:09:00 UTC, Is it possible to store different generic types? wrote: [...] Okay the issue se

Re: Is this a bug?

2016-12-10 Thread Ali Çehreli via Digitalmars-d
On 12/10/2016 12:16 AM, Is it possible to store different generic types? wrote: > Okay the issue seem to be that D casts the left-hand argument to the > same type as the right-hand argument. Seems to be but not true. It's more like "anything that touches an unsigned type turns unsigned". :)

Re: Is this a bug?

2016-12-10 Thread Stefan Koch via Digitalmars-d
On Saturday, 10 December 2016 at 08:16:48 UTC, Is it possible to store different generic types? wrote: On Saturday, 10 December 2016 at 08:09:00 UTC, Is it possible to store different generic types? wrote: [...] Okay the issue seem to be that D casts the left-hand argument to the same type as t

Re: Is this a bug?

2016-12-10 Thread Is it possible to store different generic types? via Digitalmars-d
On Saturday, 10 December 2016 at 08:09:00 UTC, Is it possible to store different generic types? wrote: I'm pretty sure the following code should work, but it doesn't. ``` bool intersect(ptrdiff_t targetX, ptrdiff_t targetY, size_t targetWidth, size_t targetHeight, ptrdiff_t x, ptrdiff_t y, siz

Is this a bug?

2016-12-10 Thread Is it possible to store different generic types? via Digitalmars-d
I'm pretty sure the following code should work, but it doesn't. ``` bool intersect(ptrdiff_t targetX, ptrdiff_t targetY, size_t targetWidth, size_t targetHeight, ptrdiff_t x, ptrdiff_t y, size_t width, size_t height) { return targetX < x + width && x < targetX + targetWidth && t

Re: core.thread.[Ss]leep - Is this a bug?

2015-05-13 Thread Vladimir Panteleev via Digitalmars-d
On Wednesday, 13 May 2015 at 20:09:44 UTC, wobbles wrote: On windows, core.thread.Sleep (big 'S') On linux core.thread.sleep (little 'S') I'm trying to import as little symbols as possible, so was importing specific items like import core.thread : Sleep; but it fails when I compile on lin

Re: core.thread.[Ss]leep - Is this a bug?

2015-05-13 Thread wobbles via Digitalmars-d
On Wednesday, 13 May 2015 at 20:16:34 UTC, John Chapman wrote: On Wednesday, 13 May 2015 at 20:09:44 UTC, wobbles wrote: On windows, core.thread.Sleep (big 'S') On linux core.thread.sleep (little 'S') I'm trying to import as little symbols as possible, so was importing specific items like

Re: core.thread.[Ss]leep - Is this a bug?

2015-05-13 Thread John Chapman via Digitalmars-d
On Wednesday, 13 May 2015 at 20:09:44 UTC, wobbles wrote: On windows, core.thread.Sleep (big 'S') On linux core.thread.sleep (little 'S') I'm trying to import as little symbols as possible, so was importing specific items like import core.thread : Sleep; but it fails when I compile on lin

core.thread.[Ss]leep - Is this a bug?

2015-05-13 Thread wobbles via Digitalmars-d
On windows, core.thread.Sleep (big 'S') On linux core.thread.sleep (little 'S') I'm trying to import as little symbols as possible, so was importing specific items like import core.thread : Sleep; but it fails when I compile on linux, so I need to do a version(Windows) import core.thread :

Re: Is this a bug in return type inference?

2015-04-26 Thread Meta via Digitalmars-d
On Sunday, 26 April 2015 at 20:21:32 UTC, Ali Çehreli wrote: Yes, a bug for floating types only. It seems that not the common type but the first type is used among floating point types. I wrote a short program to prove it to myself: import std.traits; import std.typetuple; import std.format;

Re: Is this a bug in return type inference?

2015-04-26 Thread Ali Çehreli via Digitalmars-d
o real without precision loss, but the opposite is not true. Is this a bug? Yes, a bug for floating types only. It seems that not the common type but the first type is used among floating point types. I wrote a short program to prove it to myself: import std.traits; import std.typetuple; im

Is this a bug in return type inference?

2015-04-26 Thread Meta via Digitalmars-d
res = test(n); //Prints "float" pragma(msg, typeof(res)); } I expected the result to be real. Why is the return type of test inferred as float instead? I would expect it to choose real, as both int and float can be converted to real without precision loss, but the opposite is not true. Is this a bug?

Re: Is this a bug? `static if` fails silently.

2014-11-04 Thread Meta via Digitalmars-d
On Tuesday, 4 November 2014 at 21:20:59 UTC, Tofu Ninja wrote: On Tuesday, 4 November 2014 at 09:00:12 UTC, Meta wrote: typeof(T) What is the type of a type? A kind, of course. =)

Re: Is this a bug? `static if` fails silently.

2014-11-04 Thread Tofu Ninja via Digitalmars-d
On Tuesday, 4 November 2014 at 09:00:12 UTC, Meta wrote: typeof(T) What is the type of a type?

Re: Is this a bug? `static if` fails silently.

2014-11-04 Thread John Colvin via Digitalmars-d
On Tuesday, 4 November 2014 at 09:54:44 UTC, John Colvin wrote: On Tuesday, 4 November 2014 at 09:07:10 UTC, deadalnix wrote: On Tuesday, 4 November 2014 at 09:00:12 UTC, Meta wrote: struct Test(T) { static if (is(typeof(T) == int)) { pragma(msg, "test");

Re: Is this a bug? `static if` fails silently.

2014-11-04 Thread John Colvin via Digitalmars-d
On Tuesday, 4 November 2014 at 09:07:10 UTC, deadalnix wrote: On Tuesday, 4 November 2014 at 09:00:12 UTC, Meta wrote: struct Test(T) { static if (is(typeof(T) == int)) { pragma(msg, "test"); this(T t) {

Re: Is this a bug? `static if` fails silently.

2014-11-04 Thread deadalnix via Digitalmars-d
On Tuesday, 4 November 2014 at 09:00:12 UTC, Meta wrote: struct Test(T) { static if (is(typeof(T) == int)) { pragma(msg, "test"); this(T t) { this.t = t; } } } void ma

Re: Is this a bug? `static if` fails silently.

2014-11-04 Thread Meta via Digitalmars-d
On Tuesday, 4 November 2014 at 09:07:10 UTC, deadalnix wrote: It is not static if, it is is. Is is defined as false for invalid types. Ah, right. That's annoyingly hard to spot, but it is not a bug I suppose.

Is this a bug? `static if` fails silently.

2014-11-04 Thread Meta via Digitalmars-d
struct Test(T) { static if (is(typeof(T) == int)) { pragma(msg, "test"); this(T t) { this.t = t; } } } void main() { //Nothing is printed Test!int t; }

Re: Is this a bug?

2014-06-26 Thread Rene Zwanenburg via Digitalmars-d
On Thursday, 26 June 2014 at 12:52:54 UTC, hane wrote: DMD 2.066(git head) compiled both without error. Thanks for checking!

Re: Is this a bug?

2014-06-26 Thread Rene Zwanenburg via Digitalmars-d
On Thursday, 26 June 2014 at 13:25:00 UTC, Meta wrote: Yes, this is a bug. This code should work. If it doesn't compile with Git HEAD, you should file a bug report. Apparently it does. I'm not set up to build DMD myself so I'm always just using the latest release.

Re: Is this a bug?

2014-06-26 Thread John Colvin via Digitalmars-d
On Thursday, 26 June 2014 at 12:38:40 UTC, John Colvin wrote: On Thursday, 26 June 2014 at 10:09:53 UTC, Rene Zwanenburg wrote: I /think/ this is a bug, but I'm not 100% sure. The following compiles without any problems, as it should: import std.typecons; alias Handle(T) = RefCounted!(T, RefC

Re: Is this a bug?

2014-06-26 Thread Meta via Digitalmars-d
On Thursday, 26 June 2014 at 10:09:53 UTC, Rene Zwanenburg wrote: I /think/ this is a bug, but I'm not 100% sure. The following compiles without any problems, as it should: import std.typecons; alias Handle(T) = RefCounted!(T, RefCountedAutoInitialize.no); auto initialized(T)() if(is(T == Ref

Re: Is this a bug?

2014-06-26 Thread hane via Digitalmars-d
On Thursday, 26 June 2014 at 10:09:53 UTC, Rene Zwanenburg wrote: I /think/ this is a bug, but I'm not 100% sure. The following compiles without any problems, as it should: import std.typecons; alias Handle(T) = RefCounted!(T, RefCountedAutoInitialize.no); auto initialized(T)() if(is(T == Ref

Re: Is this a bug?

2014-06-26 Thread John Colvin via Digitalmars-d
On Thursday, 26 June 2014 at 10:09:53 UTC, Rene Zwanenburg wrote: I /think/ this is a bug, but I'm not 100% sure. The following compiles without any problems, as it should: import std.typecons; alias Handle(T) = RefCounted!(T, RefCountedAutoInitialize.no); auto initialized(T)() if(is(T == Ref

Is this a bug?

2014-06-26 Thread Rene Zwanenburg via Digitalmars-d
I /think/ this is a bug, but I'm not 100% sure. The following compiles without any problems, as it should: import std.typecons; alias Handle(T) = RefCounted!(T, RefCountedAutoInitialize.no); auto initialized(T)() if(is(T == RefCounted!S, S...)) { T refCounted; refCounted.refCou

Re: Non-unittest code crashes when built in unittest mode, but not when in debug/release. Is this a bug?

2014-02-13 Thread Nicolas F.
I think I have found the issue. The problem was a circlular reference in some class that managed the creation and destruction of PartyAnimals. Now I still don't know how that triggered the behaviour that I saw, but I do have a theory. When a certain size of memory is allocated, the GC may hav

Re: Non-unittest code crashes when built in unittest mode, but not when in debug/release. Is this a bug?

2014-02-12 Thread Daniel Murphy
"Nicolas F." wrote in message news:fnamiajuljitahfgv...@forum.dlang.org... So I've been chasing after this issue for the better part of an hour, and as I dug deeper, it just got weirder and weirder. I suggest downloading the latest beta and seeing if that solves your problem - the bug may h

Non-unittest code crashes when built in unittest mode, but not when in debug/release. Is this a bug?

2014-02-11 Thread Nicolas F.
So I've been chasing after this issue for the better part of an hour, and as I dug deeper, it just got weirder and weirder. I have an Interface, let's call it PartyAnimal, and three classes, one of which is exclusive to unittest. class Equine is an abstract class that implements some of PartyA

Re: Is this a bug?

2013-12-02 Thread Jerry
"H. S. Teoh" writes: > On Thu, Nov 28, 2013 at 05:11:25PM +0900, Kenji Hara wrote: >> Might be related? >> https://d.puremagic.com/issues/show_bug.cgi?id=11406 > [...] > > Based on my investigation, I'm pretty sure it's the same bug. I concur. Compiling with head gives me a working binary for t

Re: Is this a bug?

2013-12-02 Thread H. S. Teoh
On Thu, Nov 28, 2013 at 05:11:25PM +0900, Kenji Hara wrote: > Might be related? > https://d.puremagic.com/issues/show_bug.cgi?id=11406 [...] Based on my investigation, I'm pretty sure it's the same bug. T -- Winners never quit, quitters never win. But those who never quit AND never win are id

Re: Is this a bug ?

2013-11-29 Thread bearophile
Adam D. Ruppe: It is perfectly valid to pass a string to the write function. He simply called the wrong function. Sorry. Bye, bearophile

Re: Is this a bug ?

2013-11-28 Thread Binarydepth
On Friday, 29 November 2013 at 01:37:15 UTC, Adam D. Ruppe wrote: On Friday, 29 November 2013 at 01:35:31 UTC, bearophile wrote: A statically typed language should give a compile-time error for such mistake. It is perfectly valid to pass a string to the write function. He simply called the wr

Re: Is this a bug ?

2013-11-28 Thread Adam D. Ruppe
On Friday, 29 November 2013 at 01:35:31 UTC, bearophile wrote: A statically typed language should give a compile-time error for such mistake. It is perfectly valid to pass a string to the write function. He simply called the wrong function.

Re: Is this a bug ?

2013-11-28 Thread Adam D. Ruppe
On Friday, 29 November 2013 at 01:17:36 UTC, Binarydepth wrote: So weird I get seg fault. which OS are you using ? linux

Re: Is this a bug ?

2013-11-28 Thread bearophile
Adam D. Ruppe: write(" %d: %d\n", bd, an); This should be writef instead of write. writef uses the format string, plain write just literally outputs its arguments. A statically typed language should give a compile-time error for such mistake. It's a leftover from the weakly typed C mindset

Re: Is this a bug ?

2013-11-28 Thread Binarydepth
On Friday, 29 November 2013 at 00:40:29 UTC, Adam D. Ruppe wrote: On Friday, 29 November 2013 at 00:35:30 UTC, Binarydepth wrote: It compiles but in run time terminal shows a segmentation fault. works for me without segfaulting. What data did you input? write(" %d: %d\n", bd, an); This sh

Re: Is this a bug ?

2013-11-28 Thread Adam D. Ruppe
On Friday, 29 November 2013 at 00:35:30 UTC, Binarydepth wrote: It compiles but in run time terminal shows a segmentation fault. works for me without segfaulting. What data did you input? write(" %d: %d\n", bd, an); This should be writef instead of write. writef uses the format string, pl

Is this a bug ?

2013-11-28 Thread Binarydepth
Here is my code : It compiles but in run time terminal shows a segmentation fault. Am I doing something wrong ? Or do I have to file a Bug ? import std.stdio : write, readf; void funcion(int a, int t) { int temp, bd, an; temp=t

Re: Is this a bug?

2013-11-28 Thread Kenji Hara
Might be related? https://d.puremagic.com/issues/show_bug.cgi?id=11406 Kenji Hara 2013/11/27 Jerry > Philippe Sigaud writes: > > > No crash on Linux (Kubuntu) 32bits, DMD 2.064.2. > > > > Works with 5 or 6 case's also. > > This is actually Ubuntu 12.10 64 bit. The last mysterious crash I had

Re: Is this a bug?

2013-11-27 Thread H. S. Teoh
[Taking this back to the forum, if you don't mind, since it seems to be relevant.] On Wed, Nov 27, 2013 at 03:36:17PM -0500, Jerry wrote: > "H. S. Teoh" writes: > > > I'm interested in the disassembly of the faulty executable. Maybe > > you could run `objdump -D $program_name` and send me the ou

Re: Is this a bug?

2013-11-27 Thread H. S. Teoh
On Wed, Nov 27, 2013 at 01:42:04PM -0500, Jerry wrote: > "deadalnix" writes: > > > On Wednesday, 27 November 2013 at 07:09:17 UTC, Jerry wrote: > >> Philippe Sigaud writes: > >> > >>> No crash on Linux (Kubuntu) 32bits, DMD 2.064.2. > >>> > >>> Works with 5 or 6 case's also. > >> > >> This is ac

Re: Is this a bug?

2013-11-27 Thread Jerry
"deadalnix" writes: > On Wednesday, 27 November 2013 at 07:09:17 UTC, Jerry wrote: >> Philippe Sigaud writes: >> >>> No crash on Linux (Kubuntu) 32bits, DMD 2.064.2. >>> >>> Works with 5 or 6 case's also. >> >> This is actually Ubuntu 12.10 64 bit. The last mysterious crash I had >> was due to

Re: Is this a bug?

2013-11-27 Thread H. S. Teoh
On Wed, Nov 27, 2013 at 02:06:33AM -0500, Jerry wrote: > Jerry writes: > > > "H. S. Teoh" writes: > > > >> On Tue, Nov 26, 2013 at 06:33:28PM -0500, Jerry wrote: > >>> If I read correctly, the following is legal code. If you comment out > >>> one of the case statements, it does the expected thi

Re: Is this a bug?

2013-11-27 Thread David Eagen
No crash on Ubuntu 13.10 x86_64 using the dmd 2.064.2 package downloaded from dlang.org.

Re: Is this a bug?

2013-11-27 Thread Orfeo
No crash on ArchLinux 3.12.0-1-ARCH x86_64 GNU/Linux

Re: Is this a bug?

2013-11-27 Thread deadalnix
On Wednesday, 27 November 2013 at 07:09:17 UTC, Jerry wrote: Philippe Sigaud writes: No crash on Linux (Kubuntu) 32bits, DMD 2.064.2. Works with 5 or 6 case's also. This is actually Ubuntu 12.10 64 bit. The last mysterious crash I had was due to the use of gold vs ld. It seems Debian and

Re: Is this a bug?

2013-11-26 Thread Jerry
Philippe Sigaud writes: > No crash on Linux (Kubuntu) 32bits, DMD 2.064.2. > > Works with 5 or 6 case's also. This is actually Ubuntu 12.10 64 bit. The last mysterious crash I had was due to the use of gold vs ld. It seems Debian and Ubuntu are the only ones using gold at the moment. I'm wond

Re: Is this a bug?

2013-11-26 Thread Jerry
Jerry writes: > "H. S. Teoh" writes: > >> On Tue, Nov 26, 2013 at 06:33:28PM -0500, Jerry wrote: >>> If I read correctly, the following is legal code. If you comment out >>> one of the case statements, it does the expected thing. With 4 or more, >>> it crashes. This is with dmd 2.064.2 on Deb

Re: Is this a bug?

2013-11-26 Thread Jerry
"H. S. Teoh" writes: > On Tue, Nov 26, 2013 at 06:33:28PM -0500, Jerry wrote: >> If I read correctly, the following is legal code. If you comment out >> one of the case statements, it does the expected thing. With 4 or more, >> it crashes. This is with dmd 2.064.2 on Debian. >> >> If it's a b

Re: Is this a bug?

2013-11-26 Thread Philippe Sigaud
No crash on Linux (Kubuntu) 32bits, DMD 2.064.2. Works with 5 or 6 case's also.

Re: Is this a bug?

2013-11-26 Thread evilrat
On Tuesday, 26 November 2013 at 23:33:30 UTC, Jerry wrote: This is with dmd 2.064.2 on Debian. windows 64 bit no crash.

Re: Is this a bug?

2013-11-26 Thread H. S. Teoh
On Tue, Nov 26, 2013 at 06:33:28PM -0500, Jerry wrote: > If I read correctly, the following is legal code. If you comment out > one of the case statements, it does the expected thing. With 4 or more, > it crashes. This is with dmd 2.064.2 on Debian. > > If it's a bug, I'll file a report. Thank

Re: Is this a bug?

2013-11-26 Thread growler
On Wednesday, 27 November 2013 at 00:55:21 UTC, bearophile wrote: Jerry: This is with dmd 2.064.2 on Debian. If it's a bug, I'll file a report. Thanks! I see no crash on Windows 32 bit. Bye, bearophile No crash on Fedora 19 x86_64 Cheers G.

Re: Is this a bug?

2013-11-26 Thread bearophile
Jerry: This is with dmd 2.064.2 on Debian. If it's a bug, I'll file a report. Thanks! I see no crash on Windows 32 bit. Bye, bearophile

Is this a bug?

2013-11-26 Thread Jerry
If I read correctly, the following is legal code. If you comment out one of the case statements, it does the expected thing. With 4 or more, it crashes. This is with dmd 2.064.2 on Debian. If it's a bug, I'll file a report. Thanks! class BB {} class DD : CC {} class CC : BB { static CC crea

Re: Is this a bug? RandomSample claims it needs input range but actually needs forward range

2013-06-19 Thread finalpatch
Joseph Rushton Wakeling writes: > On 06/19/2013 04:49 AM, finalpatch wrote: >> I was testing with DMD 2.063 > > Try the very latest, 2.063.2 ... ? 2.063 was released on 28 May, my fix got > committed on 7 June. > 2.063.2 has the same bug. But good to know it's fixed in git master. -- finalpat

Re: Is this a bug? RandomSample claims it needs input range but actually needs forward range

2013-06-18 Thread Jonathan M Davis
On Wednesday, June 19, 2013 05:48:13 finalpatch wrote: > So you are saying this is a bug in std.random? Yes. - Jonathan M Davis

Re: Is this a bug? RandomSample claims it needs input range but actually needs forward range

2013-06-18 Thread Joseph Rushton Wakeling
On 06/19/2013 03:32 AM, Jonathan M Davis wrote: > Any function which uses save requires at least a forward range, and if its > template constraint requires only an input range, then its template > constraint > is wrong. _Any_ function whose template constraint does not actually > guarantee > t

Re: Is this a bug? RandomSample claims it needs input range but actually needs forward range

2013-06-18 Thread Joseph Rushton Wakeling
On 06/19/2013 04:49 AM, finalpatch wrote: > I was testing with DMD 2.063 Try the very latest, 2.063.2 ... ? 2.063 was released on 28 May, my fix got committed on 7 June.

Re: Is this a bug? RandomSample claims it needs input range but actually needs forward range

2013-06-18 Thread finalpatch
On Wednesday, 19 June 2013 at 03:46:11 UTC, Joseph Rushton Wakeling wrote: On 06/19/2013 02:56 AM, finalpatch wrote: in the declaration of RandomSample it only checks for isInputRange, but in the implementation it calls the .save() method which is only available in forward ranges. What compi

Re: Is this a bug? RandomSample claims it needs input range but actually needs forward range

2013-06-18 Thread finalpatch
result this code does not compile: void main() { auto a = File("test.d", "r").byLine(); auto s = randomSample(a,1,5); writeln(s); } Is this a bug or I missed something? Any function which uses save requires at least a forward range, and if its template constraint requires

Re: Is this a bug? RandomSample claims it needs input range but actually needs forward range

2013-06-18 Thread Joseph Rushton Wakeling
On 06/19/2013 02:56 AM, finalpatch wrote: > in the declaration of RandomSample it only checks for isInputRange, but in the > implementation it calls the .save() method which is only available in forward > ranges. What compiler and version are you using? This was reported here: http://d.puremagic.

Re: Is this a bug? RandomSample claims it needs input range but actually needs forward range

2013-06-18 Thread Jonathan M Davis
oid main() > { > auto a = File("test.d", "r").byLine(); > auto s = randomSample(a,1,5); > writeln(s); > } > > Is this a bug or I missed something? Any function which uses save requires at least a forward range, and if its template constraint requires only

Is this a bug? RandomSample claims it needs input range but actually needs forward range

2013-06-18 Thread finalpatch
ne(); auto s = randomSample(a,1,5); writeln(s); } Is this a bug or I missed something?

Re: GDC is this a bug or a feature?

2012-11-11 Thread Iain Buclaw
On 11 November 2012 19:03, Russel Winder wrote: > On Sun, 2012-11-11 at 11:17 +, Iain Buclaw wrote: > […] >> I'd say feature. If libgphobos was a shared object, I don't believe >> you would get this. > > So the upshot is that we need to indent for libgphobos2.so in order for > D to be useful

Re: GDC is this a bug or a feature?

2012-11-11 Thread Russel Winder
On Sun, 2012-11-11 at 11:17 +, Iain Buclaw wrote: […] > I'd say feature. If libgphobos was a shared object, I don't believe > you would get this. So the upshot is that we need to indent for libgphobos2.so in order for D to be useful in association with Python and ctypes. I guess the question

Re: GDC is this a bug or a feature?

2012-11-11 Thread RenatoUtsch
On Sunday, 11 November 2012 at 10:39:41 UTC, Russel Winder wrote: |> gdc -o lib_helloWorld.so -shared helloWorld.os /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.6/libgphobos2.a(object_.o): relocation R_X86_64_32S against `_D11TypeInfo_Pv6__initZ' can not be used when making a shared object; r

Re: GDC is this a bug or a feature?

2012-11-11 Thread Iain Buclaw
On 11 November 2012 10:39, Russel Winder wrote: > > |> gdc -o lib_helloWorld.so -shared helloWorld.os > /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.6/libgphobos2.a(object_.o): > relocation R_X86_64_32S against `_D11TypeInfo_Pv6__initZ' can not be used > when making a shared object; recompile wi

GDC is this a bug or a feature?

2012-11-11 Thread Russel Winder
|> gdc -o lib_helloWorld.so -shared helloWorld.os /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.6/libgphobos2.a(object_.o): relocation R_X86_64_32S against `_D11TypeInfo_Pv6__initZ' can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc/x86_64-linux-gnu/4.6/libgphobos2.a:

Re: Is this a bug?

2012-04-20 Thread Steven Schveighoffer
On Fri, 20 Apr 2012 15:21:12 -0400, Robert Clipsham wrote: I've been staring blankly at this for a while now and want some input from others: void foo(T, U...)(bool arg) { if (arg) { assert(T.tupleof.length == U.length); assert(arg); /* Line 6 */ /

Is this a bug?

2012-04-20 Thread Robert Clipsham
I've been staring blankly at this for a while now and want some input from others: void foo(T, U...)(bool arg) { if (arg) { assert(T.tupleof.length == U.length); assert(arg); /* Line 6 */ // Or some other code here } } struct A {} void main() { foo!(A

Re: Is This a Bug

2011-10-26 Thread Jonathan M Davis
On Wednesday, October 26, 2011 21:05:10 Timon Gehr wrote: > map!q{ a }(a); fails purity validation too. > That is possibly a compiler bug. Quite possibly. I'd have to look at it. There are certainly cases where things should be pure or should able to be pure but aren't or can't right now, but th

Re: Is This a Bug

2011-10-26 Thread Timon Gehr
On 10/26/2011 07:01 PM, Jonathan M Davis wrote: On Wednesday, October 26, 2011 03:04 bearophile wrote: Jonathan M Davis: On Wednesday, October 26, 2011 11:15:20 Gor Gyolchanyan wrote: I see. But is there any practical advantage of a function being pure? I mean, besides an optimization hint for

Re: Is This a Bug

2011-10-26 Thread Jonathan M Davis
On Wednesday, October 26, 2011 03:04 bearophile wrote: > Jonathan M Davis: > > On Wednesday, October 26, 2011 11:15:20 Gor Gyolchanyan wrote: > > > I see. But is there any practical advantage of a function being pure? > > > I mean, besides an optimization hint for the compiler, of course. > > > >

Re: Is This a Bug

2011-10-26 Thread bearophile
Jonathan M Davis: > On Wednesday, October 26, 2011 11:15:20 Gor Gyolchanyan wrote: > > I see. But is there any practical advantage of a function being pure? > > I mean, besides an optimization hint for the compiler, of course. > > 1. You know that it doesn't access global variables, which is at m

Re: Is This a Bug

2011-10-26 Thread Timon Gehr
On 10/26/2011 09:15 AM, Gor Gyolchanyan wrote: I see. But is there any practical advantage of a function being pure? I mean, besides an optimization hint for the compiler, of course. It is very useful for reasoning about code, because a pure function will always behave the same when called wi

Re: Is This a Bug

2011-10-26 Thread Jonathan M Davis
On Wednesday, October 26, 2011 11:15:20 Gor Gyolchanyan wrote: > I see. But is there any practical advantage of a function being pure? > I mean, besides an optimization hint for the compiler, of course. 1. You know that it doesn't access global variables, which is at minimum an advantage as far a

Re: Is This a Bug

2011-10-26 Thread Gor Gyolchanyan
I see. But is there any practical advantage of a function being pure? I mean, besides an optimization hint for the compiler, of course. On Tue, Oct 25, 2011 at 10:41 PM, Jonathan M Davis wrote: > On Tuesday, October 25, 2011 10:34 Gor Gyolchanyan wrote: >> I thought pure functions can't modify th

Re: Is This a Bug

2011-10-25 Thread Jonathan M Davis
On Tuesday, October 25, 2011 10:34 Gor Gyolchanyan wrote: > I thought pure functions can't modify their parameters (along with any > other non-local variables). > if the pure function can't modify anything non-local, why should it > care whether it's getting called from a shared context or not? No

Re: Is This a Bug

2011-10-25 Thread David Nadlinger
On 10/25/11 7:34 PM, Gor Gyolchanyan wrote: I thought pure functions can't modify their parameters (along with any other non-local variables). No, pure functions has no effect on how functions can access their parameters. David

Re: Is This a Bug

2011-10-25 Thread Gor Gyolchanyan
I thought pure functions can't modify their parameters (along with any other non-local variables). if the pure function can't modify anything non-local, why should it care whether it's getting called from a shared context or not? On Tue, Oct 25, 2011 at 9:31 PM, Jonathan M Davis wrote: > On Tuesd

Re: Is This a Bug

2011-10-25 Thread Jonathan M Davis
On Tuesday, October 25, 2011 03:13 Gor Gyolchanyan wrote: > Pure functions don't need synchronization. Pure functions should not > be a subject to shared-ness. Why? All it means when a function is pure is that it can't access any static or module-level variables which can ever be mutated over the

Re: Is This a Bug

2011-10-25 Thread Gor Gyolchanyan
Pure functions don't need synchronization. Pure functions should not be a subject to shared-ness. On Tue, Oct 25, 2011 at 2:11 PM, Jonathan M Davis wrote: > On Tuesday, October 25, 2011 14:08:53 Gor Gyolchanyan wrote: >> I agree, there's no point in requiring pureness, but this problem must >> be

Re: Is This a Bug

2011-10-25 Thread Jonathan M Davis
On Tuesday, October 25, 2011 14:08:53 Gor Gyolchanyan wrote: > I agree, there's no point in requiring pureness, but this problem must > be dealt with anyway. The user must never receive errors regarding > invalid call of invariants. Sure, but this issue has nothing to do with purity. It has to do

  1   2   >