mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-14 20:03:14 +01:00
Fix uninitialized vars in EnumDeclaration
'protection' and 'parent' are used in ScopeDSymbol::search detected by Valgrind). The assignment in semantic0 is enough to fix the bug, but I also added an initialization to the constructor. This is a backport of DMD commit 4dfaf02d4d by Don Clugston.
This commit is contained in:
@@ -38,6 +38,8 @@ EnumDeclaration::EnumDeclaration(Loc loc, Identifier *id, Type *memtype)
|
||||
#if IN_DMD
|
||||
objFileDone = 0;
|
||||
#endif
|
||||
protection = PROTundefined;
|
||||
parent = NULL;
|
||||
}
|
||||
|
||||
Dsymbol *EnumDeclaration::syntaxCopy(Dsymbol *s)
|
||||
@@ -79,6 +81,10 @@ void EnumDeclaration::semantic0(Scope *sc)
|
||||
|
||||
if (isdone || !scope)
|
||||
return;
|
||||
|
||||
parent = scope->parent;
|
||||
protection = scope->protection;
|
||||
|
||||
if (!isAnonymous() || memtype)
|
||||
return;
|
||||
for (size_t i = 0; i < members->dim; i++)
|
||||
|
||||
Reference in New Issue
Block a user