# HG changeset patch # User Frits van Bommel # Date 1242829259 -7200 # Node ID e2cf1f67ca339fb2cb02166d1fc05622e991a5e6 # Parent 4100c49b753ffa3f4fdcde3a8f60b2f90728edcb 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). diff -r 4100c49b753f -r e2cf1f67ca33 dmd/declaration.c --- a/dmd/declaration.c Tue May 19 22:35:08 2009 +0200 +++ b/dmd/declaration.c Wed May 20 16:20:59 2009 +0200 @@ -575,7 +575,7 @@ { if (haliassym) { - haliassym->toCBuffer(buf, hgs); + buf->writestring(haliassym->toChars()); buf->writeByte(' '); buf->writestring(ident->toChars()); } @@ -587,7 +587,7 @@ { if (aliassym) { - aliassym->toCBuffer(buf, hgs); + buf->writestring(aliassym->toChars()); buf->writeByte(' '); buf->writestring(ident->toChars()); } diff -r 4100c49b753f -r e2cf1f67ca33 gen/toir.cpp --- a/gen/toir.cpp Tue May 19 22:35:08 2009 +0200 +++ b/gen/toir.cpp Wed May 20 16:20:59 2009 +0200 @@ -1774,7 +1774,7 @@ 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); diff -r 4100c49b753f -r e2cf1f67ca33 tests/mini/compile_bug305.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/mini/compile_bug305.d Wed May 20 16:20:59 2009 +0200 @@ -0,0 +1,7 @@ +module bug305; + +class E { + void A() { + alias E m; + } +}