[Issue 8850] New: Nested struct creation by a template

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 18 14:15:08 PDT 2012


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

           Summary: Nested struct creation by a template
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: Jesse.K.Phillips+D at gmail.com


--- Comment #0 from Jesse Phillips <Jesse.K.Phillips+D at gmail.com> 2012-10-18 14:15:06 PDT ---
I'm not sure the intended behavior but currently is inconsistent. The following
code fails to compile with:

bad.d(2): Error: function D main is a nested function and cannot be accessed
from bad.fun!(R).fun

T fun(T)() if(is(T == struct)) {
    T s;
    return s;
}

void main() {
    struct R {
        void f() { }
    }

    auto m = fun!R();
}

However removing the function from the struct definition (include other values
if desired) then it will compile. I'd think we'd want templates to have the
ability to create a nested struct.

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