[Issue 10251] New: CTFE: Allow returning pointers to global static variables of known value

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jun 3 02:42:32 PDT 2013


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

           Summary: CTFE: Allow returning pointers to global static
                    variables of known value
           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-06-03 02:42:28 PDT ---
This is a bug. It works if the variable doesn't have a known value!
It also works in optimize(WANTinterpret) but not CTFE,

----
static const int glob10251 = 7;

const (int) * bug10251()
{
   return &glob10251;
}

static a10251 = &glob10251; //  OK
static b10251 = bug10251(); // Fails

---
bug.d(10): Error: cannot use non-constant CTFE pointer in an initializer
'glob10251'

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