Structs as template parameters: weird error message

biozic via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 2 16:12:23 PDT 2015


The code below doesn't compile. Why this error message?
---
struct Item {
     int i;
}

struct Params {
     Item* item;

     this(int i) {
         item = new Item(i);  // line 9
     }
}

struct Foo(Params params) {}

enum foo = Foo!(Params(1));
---

test.d(9): Error: Item(1) is not an lvalue


More information about the Digitalmars-d-learn mailing list