Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-21 Thread H. S. Teoh
On Wed, Mar 21, 2012 at 10:55:05AM +0100, David Nadlinger wrote: > On Wednesday, 21 March 2012 at 09:51:43 UTC, Jens Mueller wrote: > >Interesting. How do I make use of this? > > > >[…] > > > >What's the trick to use memory allocated in a CTFE. Say e.g. I want > >to build a tree at compile time usi

Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-21 Thread Jacob Carlborg
On 2012-03-21 11:53, Don Clugston wrote: > You can return structs and arrays, because we have struct literals and > array literals, but there is no such thing as a class literal. CTFE will > currently allow you to return a class, but only if it is null. What about anonymous nested classes, would t

Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-21 Thread Jens Mueller
Don Clugston wrote: > On 21/03/12 11:22, Jens Mueller wrote: > > David Nadlinger wrote: > >> On Wednesday, 21 March 2012 at 09:51:43 UTC, Jens Mueller wrote: > >>> Interesting. How do I make use of this? > >>> > >>> […] > >>> > >>> What's the trick to use memory allocated in a CTFE. Say e.g. I > >>

Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-21 Thread Don Clugston
On 21/03/12 11:22, Jens Mueller wrote: > David Nadlinger wrote: >> On Wednesday, 21 March 2012 at 09:51:43 UTC, Jens Mueller wrote: >>> Interesting. How do I make use of this? >>> >>> […] >>> >>> What's the trick to use memory allocated in a CTFE. Say e.g. I >>> want to >>> build a tree at compile

Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-21 Thread Jens Mueller
David Nadlinger wrote: > On Wednesday, 21 March 2012 at 09:51:43 UTC, Jens Mueller wrote: > >Interesting. How do I make use of this? > > > >[…] > > > >What's the trick to use memory allocated in a CTFE. Say e.g. I > >want to > >build a tree at compile time using CTFE. > > You can't do that right n

Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-21 Thread David Nadlinger
On Wednesday, 21 March 2012 at 09:51:43 UTC, Jens Mueller wrote: Interesting. How do I make use of this? […] What's the trick to use memory allocated in a CTFE. Say e.g. I want to build a tree at compile time using CTFE. You can't do that right now (i.e. converting CTFE-allocated memory to

Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-21 Thread Jens Mueller
Don wrote: > On 19.03.2012 18:25, H. S. Teoh wrote: > >On Mon, Mar 19, 2012 at 09:49:07AM +0100, Don Clugston wrote: > >[...] > >>Yes. The existing D2 AA implementation is hopelessly broken. > >>You have to understand that the whole implementation of AAs in D2 is > >>a HACK. It is extremely complic

Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-19 Thread Don
On 19.03.2012 22:14, H. S. Teoh wrote: On Mon, Mar 19, 2012 at 09:46:04PM +0100, Don wrote: On 19.03.2012 18:25, H. S. Teoh wrote: [...] The main idea is to require a minimal number of lowerings from the compiler (effectively nothing more than syntactic sugar such as V[K] and AA literal syntax

Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-19 Thread H. S. Teoh
On Mon, Mar 19, 2012 at 09:46:04PM +0100, Don wrote: > On 19.03.2012 18:25, H. S. Teoh wrote: [...] > >The main idea is to require a minimal number of lowerings from the > >compiler (effectively nothing more than syntactic sugar such as V[K] > >and AA literal syntax), and everything else will be do

Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-19 Thread Don
On 19.03.2012 18:25, H. S. Teoh wrote: On Mon, Mar 19, 2012 at 09:49:07AM +0100, Don Clugston wrote: [...] Yes. The existing D2 AA implementation is hopelessly broken. You have to understand that the whole implementation of AAs in D2 is a HACK. It is extremely complicated and the slightest chang

Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-19 Thread H. S. Teoh
On Mon, Mar 19, 2012 at 09:49:07AM +0100, Don Clugston wrote: [...] > Yes. The existing D2 AA implementation is hopelessly broken. > You have to understand that the whole implementation of AAs in D2 is > a HACK. It is extremely complicated and the slightest change to any > code in the compiler or t

Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-19 Thread Daniel Murphy
"Don Clugston" wrote in message news:jk6ru4$1seu$1...@digitalmars.com... > > I do not understand why it still part of the compiler after we agreed to > roll back to the D1 version. > Walter didn't agree, so it didn't happen.

Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-19 Thread Don Clugston
On 19/03/12 06:43, H. S. Teoh wrote: While testing my AA implementation on existing AA-related bug, I came across this issue: http://d.puremagic.com/issues/show_bug.cgi?id=7602 Upon playing around a bit with the sample code given in the bug, I managed to find a code snippet that would c

CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-18 Thread H. S. Teoh
While testing my AA implementation on existing AA-related bug, I came across this issue: http://d.puremagic.com/issues/show_bug.cgi?id=7602 Upon playing around a bit with the sample code given in the bug, I managed to find a code snippet that would cause this code: if (impl !is