Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REG2.064a] fix issue 10612 - ICE on using enum as hash key with mutual module imports #2336

Merged
merged 1 commit into from Jul 13, 2013

Conversation

hpohl
Copy link
Contributor

@hpohl hpohl commented Jul 11, 2013

@@ -7272,7 +7274,7 @@ Type *TypeEnum::syntaxCopy()
Type *TypeEnum::semantic(Loc loc, Scope *sc)
{
//printf("TypeEnum::semantic() %s\n", toChars());
//sym->semantic(sc);
sym->semantic(sc);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually not sure about this. Isn't this the wrong scope?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To resolve forward reference, each Dsymbols have scope field (it's set by Dsymbol::setScope).
And also, EnumDeclaration has isdone field to avoid multiple semantic call. So here should be:

Type *TypeEnum::semantic(Loc loc, Scope *sc)
{
    //printf("TypeEnum::semantic() %s\n", toChars());
    if (!sym->isdone)
    {
        assert(sym->scope);
        sym->semantic(sym->scope);
    }
    return merge();
}

@@ -247,6 +247,15 @@ void test10561()
}

/**********************************************/
// 10612
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouch, so it's not even an import dependency issue. I guess the bug title should be renamed. :)

@9rnsr
Copy link
Contributor

9rnsr commented Jul 13, 2013

LGTM.

9rnsr added a commit that referenced this pull request Jul 13, 2013
[REG2.064a] fix issue 10612 - ICE on using enum as hash key with mutual module imports
@9rnsr 9rnsr merged commit a608afd into dlang:master Jul 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants