Bug 12681 – Rewrite rule prevents unique detection

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-04-29T21:51:00Z
Last change time
2014-05-16T07:45:37Z
Keywords
pull
Assigned to
nobody
Creator
bugzilla

Comments

Comment #0 by bugzilla — 2014-04-29T21:51:44Z
The code: immutable int x = 42; static struct S { immutable int *p; } immutable s = new S(&x); should work, but it fails because of the rewrite rule https://github.com/D-Programming-Language/dmd/blob/master/src/expression.c#L5066 /* Rewrite: * new S(arguments) * as: * (((S* __newsl = new S()), (*__newsl = S(arguments))), __newsl) */ One avenue to fix this is to mark __newsl as unique, so that the conversion will work.
Comment #1 by k.hara.pg — 2014-04-30T01:53:45Z
> /* Rewrite: > * new S(arguments) > * as: > * (((S* __newsl = new S()), (*__newsl = S(arguments))), __newsl) > */ One easy way is to move the rewriting to glue layer (in old days I couldn't do it).
Comment #2 by k.hara.pg — 2014-05-04T10:18:29Z
Comment #3 by github-bugzilla — 2014-05-16T07:45:36Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/8c3580d1973e1585b31ac6fadf10a61f1b871fbc fix fix Issue 12681 - Rewrite rule prevents unique detection Do rewriting in glue-layer. https://github.com/D-Programming-Language/dmd/commit/86fefe963ea1ae57e304aefa39215823fbccef7f Merge pull request #3522 from 9rnsr/fix12681 Issue 12681 - Rewrite rule prevents unique detection