Don't print the entire declaration of the alliassee when ->toChars() is

called on an `AliasDeclaration`; just printing the name will do. This fixes
#305, which otherwise tries to generate
{{{
  class E {
      void A() {
          alias /* recurse into E->toCBuffer() */ m;
      }
  }
}}}
by way of an infinite recursion (causing a segfault when the stack runs out).
This commit is contained in:
Frits van Bommel
2009-05-20 16:20:59 +02:00
parent ea4690128b
commit 95c35225bb
3 changed files with 10 additions and 3 deletions

View File

@@ -575,7 +575,7 @@ void AliasDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
if (haliassym)
{
haliassym->toCBuffer(buf, hgs);
buf->writestring(haliassym->toChars());
buf->writeByte(' ');
buf->writestring(ident->toChars());
}
@@ -587,7 +587,7 @@ void AliasDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
if (aliassym)
{
aliassym->toCBuffer(buf, hgs);
buf->writestring(aliassym->toChars());
buf->writeByte(' ');
buf->writestring(ident->toChars());
}

View File

@@ -1774,7 +1774,7 @@ DValue* AssertExp::toElem(IRState* p)
condty->ty == Tclass &&
!((TypeClass*)condty)->sym->isInterfaceDeclaration())
{
Logger::print("calling class invariant");
Logger::println("calling class invariant");
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_invariant");
LLValue* arg = DtoBitCast(cond->getRVal(), fn->getFunctionType()->getParamType(0));
gIR->CreateCallOrInvoke(fn, arg);

View File

@@ -0,0 +1,7 @@
module bug305;
class E {
void A() {
alias E m;
}
}