GH-1534: Fix excessive coredump for duplicate enum definitions

An adequate error message was previously reported for duplicate enum
definitions, this just now prevents trying to access it as a constant in
subsequent parsing and further generating a coredump.
This commit is contained in:
Jon Siwek 2021-04-29 15:20:09 -07:00
parent af3814792a
commit 13f3cb377f
3 changed files with 15 additions and 0 deletions

View file

@ -769,6 +769,13 @@ expr:
else if ( id->IsEnumConst() )
{
if ( IsErrorType(id->GetType()->Tag()) )
{
// The most-relevant error message should already be reported, so
// just bail out.
YYERROR;
}
EnumType* t = id->GetType()->AsEnumType();
auto intval = t->Lookup(id->ModuleName(), id->Name());
if ( intval < 0 )