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

Issue 9571 - link error due to using unique ids in anonymous funcliteral #2566

Merged
merged 1 commit into from Sep 17, 2013

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Sep 17, 2013

http://d.puremagic.com/issues/show_bug.cgi?id=9571

Emit unique-id in local scope for function literals instead of global ones.

MartinNowak added a commit that referenced this pull request Sep 17, 2013
Issue 9571 - link error due to using unique ids in anonymous funcliteral
@MartinNowak MartinNowak merged commit 3395a17 into dlang:master Sep 17, 2013
@mihails-strasuns
Copy link

Just to make sure I got idea behind the fix right - it relies on the fact that mangled name is fully qualified and restarts anonymous "counter" for each new symbol scope?

@9rnsr
Copy link
Contributor Author

9rnsr commented Sep 17, 2013

@Dicebot That's right.

@mihails-strasuns
Copy link

@9rnsr will it work properly with template mixins? (I could not get same -inline behaviour for them as in snippet so can't check)

@9rnsr
Copy link
Contributor Author

9rnsr commented Sep 17, 2013

Each template mixins has independent symbol scope, so it works as expected.

alias Id(alias a) = a;
template Mix()
{
    alias fn = Id!((){ return 0; });
}
mixin Mix!() m1;
mixin Mix!() m2;
pragma(msg, m1.fn.mangleof);  // _D4test2m19__lambda2FNaNbNfZi
pragma(msg, m2.fn.mangleof);  // _D4test2m29__lambda2FNaNbNfZi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants