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

           Summary: CTFE call of non-static member function allowed inside
                    template
           Product: D
           Version: 1.045
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzi...@digitalmars.com
        ReportedBy: kamm-removet...@incasoftware.de


>From http://www.dsource.org/projects/ldc/ticket/312

The code

---
struct Struct {
   Struct method() {
      return *this;
   }
}

template Template() {
   const CONST_STRUCT = Struct().method(); // A: no error
} 
alias Template!() foo;

const CONST_STRUCT2 = Struct().method(); // B: error
---

correctly produces an error for line B "non-constant expression
(Struct()).method()" (the CTFE spec says: "4. the function may not be a
non-static member, i.e. it may not have a this pointer"), but doesn't for line
A.

Please either make both lines work and update the spec, or make A an error.

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

Reply via email to