[dmd-internals] [D-Programming-Language/dmd] 7daa39: fix Issue 8939 - ICE(glue.c) on passing by ref sta...
Rainer Schuetze
r.sagitario at gmx.de
Wed Nov 14 23:38:01 PST 2012
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 <k.hara.pg at gmail.com>
> 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
More information about the dmd-internals
mailing list