On 11/15/2012 3:46 AM, GitHub wrote:
   Branch: refs/heads/master
   Home:   https://github.com/D-Programming-Language/dmd
   Commit: 7daa39cc3ff563b50004cda86f4cdc1ae76c2888
       
https://github.com/D-Programming-Language/dmd/commit/7daa39cc3ff563b50004cda86f4cdc1ae76c2888
   Author: k-hara <[email protected]>
   Date:   2012-11-14 (Wed, 14 Nov 2012)

   Changed paths:
     M src/expression.c
     M src/interpret.c
     M src/optimize.c
     M test/runnable/constfold.d

   Log Message:
   -----------
   fix Issue 8939 - ICE(glue.c) on passing by ref statically initialized 
const/immutable variable

Don't optimize an argument on ref parameter, even which can interpret at 
compile time.

This seems to have broken this code:


class C
{
        const int kIndex = 0;
        
        //////////////////////////////////////////////////////////////
        int refValue(V)(ref V var)
        {
                return var.length;
        }

        bool foo()
        {
                string str[2];
                return refValue(str[kIndex]) != 0;
        }
        
}


compiled with -O:

test.d(15): Error: variable kIndex used before set

_______________________________________________
dmd-internals mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-internals

Reply via email to