To trigger the bug, I need 2 modules :
module a;
class Type {
}
// TODO: allow type change only for ambiguous types.
class Expression {
Type type;
}
*********************************************************
module b;
auto dispatch(
alias unhandled = function typeof(null)(t){
throw new Exception(t.toString);
}, V, T
)(V visitor, ref T t) {
return unhandled(t);
}
import a;
Expression buildCast(bool isExplicit )(Type type, Expression e) {
auto tid = typeid(e.type);
// dito
class CastFrom {
Expression visit(Type t) {
return this.dispatch(t);
}
}
return (new CastFrom()).visit(type);
}
alias buildCast!false buildImplicitCast;
I got the following errors :
Error: need 'this' to access member type
removing the typeid solve the issue. Remplacing it by auto tid = typeid({ return e.type; }()); do solve it too.
Comment #1 by andrej.mitrovich — 2013-09-26T07:14:46Z
Fixed by pull in Issue 11010.
*** This issue has been marked as a duplicate of issue 11010 ***