[Issue 9953] New: manifest constants of reference types should be illegal

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 18 01:43:44 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9953

           Summary: manifest constants of reference types should be
                    illegal
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: clugdbug at yahoo.com.au


--- Comment #0 from Don <clugdbug at yahoo.com.au> 2013-04-18 01:43:43 PDT ---
---
enum X = [1,2,3];

void main()
{
   assert( X.ptr is X.ptr);
   assert( X is X );
}
---
Both asserts fail at runtime, because they are equivalent to

   assert( [1,2,3].ptr is [1,2,3].ptr);
   assert( [1,2,3] is [1,2,3] );

It would be OK for X to be an int[3] array, but not a slice.
Fundamentally, a reference enum type doesn't make sense. They can't have an
address.
This is the root cause of bug 4397.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list