Skip to content

Commit

Permalink
Fixed bug that would cause immutables inside template function implem…
Browse files Browse the repository at this point in the history
…entions to lose their initializers.
  • Loading branch information
Adam Wilson committed Dec 22, 2011
1 parent b62e855 commit bb539fe
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/attrib.c
Expand Up @@ -548,7 +548,7 @@ void StorageClassDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
if(stc & STCimmutable) hgs->inImmutable++; //HACK inform down-tree symbols they are immutable.

stcToCBuffer(buf, stc);
stcToCBuffer(buf, stc);
AttribDeclaration::toCBuffer(buf, hgs);

if(stc & STCimmutable) hgs->inImmutable--; //Undo the hack.
Expand Down
4 changes: 2 additions & 2 deletions src/declaration.c
Expand Up @@ -1583,8 +1583,8 @@ void VarDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
}
else
buf->writestring(ident->toChars());
if(isConst() || hgs->inImmutable || hgs->hdrgen != 1)

if(isConst() || hgs->inImmutable || storage_class & STCimmutable || hgs->hdrgen != 1)
{
if (init)
{ buf->writestring(" = ");
Expand Down
1 change: 1 addition & 0 deletions src/func.c
Expand Up @@ -1670,6 +1670,7 @@ void FuncDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
}
else
bodyToCBuffer(buf, hgs);
buf->writenl();
}

VarDeclaration *FuncDeclaration::declareThis(Scope *sc, AggregateDeclaration *ad)
Expand Down

0 comments on commit bb539fe

Please sign in to comment.