diff --git a/dmd/declaration.c b/dmd/declaration.c index 52c46fa1..c3ceb32f 100644 --- a/dmd/declaration.c +++ b/dmd/declaration.c @@ -767,13 +767,16 @@ void VarDeclaration::semantic(Scope *sc) VarDeclaration *v = new VarDeclaration(loc, arg->type, id, ti); //printf("declaring field %s of type %s\n", v->toChars(), v->type->toChars()); v->semantic(sc); - + +/* +// removed for LDC since TupleDeclaration::toObj already creates the fields; +// adding them to the scope again leads to duplicates if (sc->scopesym) { //printf("adding %s to %s\n", v->toChars(), sc->scopesym->toChars()); if (sc->scopesym->members) sc->scopesym->members->push(v); } - +*/ Expression *e = new DsymbolExp(loc, v); exps->data[i] = e; } diff --git a/tests/mini/tuplestruct.d b/tests/mini/tuplestruct.d new file mode 100644 index 00000000..debd94b8 --- /dev/null +++ b/tests/mini/tuplestruct.d @@ -0,0 +1,15 @@ +struct V(T...) { + T v; +} + +alias V!(Object, int) MyV; + +void main() +{ + assert(MyV.sizeof == Object.sizeof + int.sizeof); + auto o = new Object; + auto v = MyV(o, 3); + assert(v.v[0] is o); + assert(v.v[1] == 3); +} +