Summary: "static" allows free templated functions to accept
                    struct fields as template alias parameters
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Vladimir Panteleev <> 2012-03-31 
07:20:50 PDT ---
string f(alias X)()
    return null;

struct S
    int i;

This program doesn't compile, however uncommenting "static" makes it work.

DMD 2.058 produces this error message:

test.d(8): Error: struct test.S no size yet for forward reference

DMD git produces a different error message:

test.d(2): Error: function test.S.f!(i).f need 'this' to access member f

Note that fixing this issue by making both cases fail to compile would break
code. I believe the Orange serialization library uses this trick to stringify
field names with minimal syntax overhead.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to