www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2486] New: taking address of slice rvalue is valid


           Summary: taking address of slice rvalue is valid
           Product: D
           Version: 1.037
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: spec
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: kamm-removethis incasoftware.de

I was surprised to see that following compiles and generates reasonable code:

int[] a = [1, 2, 3]
auto addr = &a[0..2];

Since the frontend seems to explicitly allow it, it's probably intentional and
we've made LDC behave the same way. Could a description and rationale be added
to the spec?

Dec 02 2008