www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12681] New: Rewrite rule prevents unique detection


          Issue ID: 12681
           Summary: Rewrite rule prevents unique detection
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

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

/* 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.

Apr 29 2014