[Issue 3231] Function declared to return a type with its same name doesn't compile
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Aug 7 21:28:57 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3231
--- Comment #8 from Cristi Vlasceanu <cristian at zerobugs.org> 2009-08-07 21:28:56 PDT ---
@BCS
That case is indeed illegal, AND handled correctly by my fix.
You can try it out either by downloading the dnet compiler, or by applying the
change to DMD, here's the full code:
Type *TypeIdentifier::semantic(Loc loc, Scope *sc)
{
Type *t;
Expression *e;
Dsymbol *s;
//printf("TypeIdentifier::semantic(%s)\n", toChars());
resolve(loc, sc, &e, &t, &s);
if (t)
{
//printf("\tit's a type %d, %s, %s\n", t->ty, t->toChars(), t->deco);
if (t->ty == Ttypedef)
{ TypeTypedef *tt = (TypeTypedef *)t;
if (tt->sym->sem == 1)
error(loc, "circular reference of typedef %s", tt->toChars());
}
t = t->addMod(mod);
}
else
{
#ifdef DEBUG
if (!global.gag)
printf("1: ");
#endif
if (s)
{
#if TARGET_NET
//http://d.puremagic.com/issues/show_bug.cgi?id=3231
if (sc->enclosing)
return semantic(loc, sc->enclosing);
#endif
s->error(loc, "is used as a type");
//halt();
}
else
error(loc, "%s is used as a type", toChars());
t = tvoid;
}
//t->print();
return t;
}
--
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