Summary: Structs as template arguments
           Product: D
           Version: 2.040
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD

--- Comment #0 from 2010-03-05 08:17:47 PST ---
The following D2 program produces the error:
test.d(4): Error: arithmetic/string type expected for value-parameter, not Foo

struct S { int x; }

// template IncS(alias f) { // works
template IncS(S f) {        // doesn't work
    enum S IncS = S(f.x + 1);

void main() {
    enum S f1 = S(1);
    enum S f2 = IncS!(f1);

It works replacing IncS(S f) with IncS(alias f), but I think using the struct
name is more type safe (there 'alias' is like dynamic typing at compile-time).

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

Reply via email to