Thread overview
[dmd-internals] dmd commit, revision 687
Sep 25, 2010
dsource.org
Sep 26, 2010
Don Clugston
Sep 26, 2010
Walter Bright
September 24, 2010
dmd commit, revision 687


user: walter

msg:
add Don's new relaxed purity rules

http://www.dsource.org/projects/dmd/changeset/687

September 26, 2010
On 25 September 2010 02:52, dsource.org <noreply at dsource.org> wrote:
> dmd commit, revision 687
>
>
> user: walter
>
> msg:
> add Don's new relaxed purity rules
>
> http://www.dsource.org/projects/dmd/changeset/687

Great stuff!
In this part of FuncDeclaration::isPure() in func.c, I think that
should be: purity >= PUREconst.
Otherwise a member function like this one becomes PUREweak:
void foo(const X x) const pure;


 	2544	    if (purity > PUREweak && needThis())
 	2545	    {   // The attribute of the 'this' reference affects purity strength
 	2546	        if (type->mod & (MODimmutable | MODwild))
 	2547	            ;
 	2548	        else if (type->mod & MODconst && purity > PUREconst)
 	2549	            purity = PUREconst;
 	2550	        else
 	2551	            purity = PUREweak;
 	2552	    }
September 26, 2010

Don Clugston wrote:
>
> Great stuff!
> In this part of FuncDeclaration::isPure() in func.c, I think that
> should be: purity >= PUREconst.
> Otherwise a member function like this one becomes PUREweak:
> void foo(const X x) const pure;
>
>
>  	2544	    if (purity > PUREweak && needThis())
>  	2545	    {   // The attribute of the 'this' reference affects purity strength
>  	2546	        if (type->mod & (MODimmutable | MODwild))
>  	2547	            ;
>  	2548	        else if (type->mod & MODconst && purity > PUREconst)
>  	2549	            purity = PUREconst;
>  	2550	        else
>  	2551	            purity = PUREweak;
>  	2552	    }
> 

I think you're right. Fixed.