https://issues.dlang.org/show_bug.cgi?id=19786
--- Comment #4 from Basile-z <b2.t...@gmx.com> --- I wont fix the issue since it's assigned but just a few words to clarify the problem: 1. The wrong symbol is return because of a call to `getDsymbolWithoutExp()` (https://github.com/dlang/dmd/blob/93b4b99b0b024d238b223e73804c1d0c01ee42ec/src/dmd/typesem.d#L1637) 2. After this call, a type is returned from the `TraitExp`, always, even when the `TraitsExp` doesn't represent a `Type`. That's because `getType()` returns the type of the expression when the expression itself doesn't represents/wraps a `Type`. The fix would consist into detecting the invalid stuff beforehand --- if (Expression e = semanticTraits(mtype.exp, sc)) { if (TupleExp te = e.toTupleExp) mtype.sym = new TupleDeclaration(mtype.loc, Identifier.generateId("__aliastup"), cast(Objects*) te.exps); else if (Dsymbol ds = getDsymbol(e)) mtype.sym = ds; // detect invalid cases such as 19786 here at worst // if you reach this point with smthg like issue 19786 it's too late else if (Dsymbol ds = getDsymbolWithoutExpCtx(e)) mtype.sym = ds; // if you reach this point with an invalid case it's too late else if (Type t = getType(e)) result = t.addMod(mtype.mod); } --- Note in reaction to previous comment, `rhs` is not an expression, it's a `VarDeclaration`, so a symbol. --