Bug 8939 – ICE(glue.c) on passing by ref statically initialized const/immutable variable

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-11-02T07:56:00Z
Last change time
2012-11-17T16:24:06Z
Keywords
ice, pull, rejects-valid
Assigned to
nobody
Creator
verylonglogin.reg

Comments

Comment #0 by verylonglogin.reg — 2012-11-02T07:56:39Z
--- void f(T)(ref T) { } // same for `auto ref` const n = 1; // or `immutable` void main() { f(n); // main.d(8): Error: constant 1 is not an lvalue // And ICE: Assertion failure: '0' on line 1224 in file 'glue.c' } --- The bad thing is that it breaks `auto ref` too with same (incorrect now) "not an lvalue" error before ICE.
Comment #1 by verylonglogin.reg — 2012-11-02T08:23:10Z
May be connected with Issue 8940 - Able to modify const/immutable with passing to a templated function by `ref`
Comment #2 by k.hara.pg — 2012-11-14T17:59:05Z
Comment #3 by github-bugzilla — 2012-11-14T18:46:11Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/7daa39cc3ff563b50004cda86f4cdc1ae76c2888 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. https://github.com/D-Programming-Language/dmd/commit/a1e763cda40722305adb924509dd726af99e9e45 Merge pull request #1288 from 9rnsr/fix8939 Issue 8939 - ICE(glue.c) on passing by ref statically initialized const/immutable variable
Comment #4 by github-bugzilla — 2012-11-17T16:24:06Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/099d4a80f4ff315b94baeb10bb0f63cc65dfc3b7 fix regression which introduced by fixing bug 8939. Expression::optimize should keep lvalue-ness of ref argument, but its sub-expressions can be optimized aggressively. https://github.com/D-Programming-Language/dmd/commit/cc3b46ff3b5737e3e35e86b3db7d0b3b744ab7b5 Merge pull request #1293 from 9rnsr/fix8939reg fix regression which introduced by fixing bug 8939.