Bug 8439 – typeid fail to resolve symbol properly

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-07-25T11:44:00Z
Last change time
2013-09-26T07:14:46Z
Assigned to
nobody
Creator
deadalnix

Comments

Comment #0 by deadalnix — 2012-07-25T11:44:50Z
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 ***