mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-27 00:53:23 +01:00
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:
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
7
tests/mini/compile_bug305.d
Normal file
7
tests/mini/compile_bug305.d
Normal file
@@ -0,0 +1,7 @@
|
||||
module bug305;
|
||||
|
||||
class E {
|
||||
void A() {
|
||||
alias E m;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user