[Issue 8439] New: typeid fail to resolve symbol properly
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Wed Jul 25 11:44:52 PDT 2012
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=8439
           Summary: typeid fail to resolve symbol properly
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: deadalnix at gmail.com
--- Comment #0 from deadalnix <deadalnix at gmail.com> 2012-07-25 11:44:50 PDT ---
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.
-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
    
    
More information about the Digitalmars-d-bugs
mailing list