[Issue 1227] New: Access Violation when using comparison of template class pointer

Jarrett Billingsley kb3ctd2 at yahoo.com
Fri May 11 08:04:30 PDT 2007


<d-bugmail at puremagic.com> wrote in message 
news:bug-1227-3 at http.d.puremagic.com/issues/...
> http://d.puremagic.com/issues/show_bug.cgi?id=1227

Not a bug.  Use 'is' to see if a reference is null, not '=='.

>        public void add(TypeList T)
>        {
>                LinkedListLink!(TypeList) n;
>
>                synchronized(this)
>                {
>                        try
>                        {
>                                n = new LinkedListLink!(TypeList) (last, 
> T);
>                        } catch (OutOfMemoryException e)
>                        {
>                                throw e;
>                        }
>
>                        if ( this.last==null )

This last line should be:
                         if( this.last is null )

>                        {
>                                this.first = n;
>                                this.last = n;
>                        } else
>                        {
>                                this.last.next = n;
>                                this.last = n;
>                        }
>
>                        count++;
>                }
>        }
> } 




More information about the Digitalmars-d-bugs mailing list