www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8439] New: typeid fail to resolve symbol properly

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: deadalnix gmail.com



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: -------
Jul 25 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8439


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |DUPLICATE



07:14:46 PDT ---
Fixed by pull in Issue 11010.

*** This issue has been marked as a duplicate of issue 11010 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 26 2013