[Issue 9745] New: Allow non-thread local static variables to have their address taken in CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 18 04:59:42 PDT 2013


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

           Summary: Allow non-thread local static variables to have their
                    address taken in CTFE
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          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-03-18 04:59:41 PDT ---
Split off from bug 9744.

Applies to both shared and __gshared, (or any static variable in D1).
-------
shared int x1;

shared(int) * foo() { return & x1; }

shared int *p1 = & x1;  // OK

shared int *p2 = foo(); // ERROR - & x1 is not valid in CTFE.
-------
Obviously, any attempt to dereference &x1 must fail.
Likewise, it must not be valid to take the address of a thread-local variable.


This is the largest remaining difference between constant-folding and CTFE.

-- 
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