typeid() broken for interfaces?

Maxim Fomin maxim at maxim-fomin.ru
Mon Dec 3 03:06:03 PST 2012


On Monday, 3 December 2012 at 10:49:54 UTC, Gor Gyolchanyan wrote:
> Currently typeid(typeid(Interface)) == typeid(ClassInfo). So

Are you sure?

//dpaste seems to be down

import std.stdio;

interface I { }
class C: I { }

void main()
{
	I object = new C;
	writeln( typeid(object) == typeid(C) );
	writeln( typeid(Interface) == typeid(ClassInfo) );
	writeln( typeid(typeid(Interface)) == typeid(ClassInfo) );
}

Using latest dmd from git head I get three falses.


More information about the Digitalmars-d mailing list