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 11286 - Impure dtor makes "cannot call impure function" error, although it won't actually be called. #2677

Merged
merged 1 commit into from
Nov 8, 2013

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Oct 17, 2013

@monarchdodra
Copy link
Contributor

I left a question here:
http://d.puremagic.com/issues/show_bug.cgi?id=11287#c1

Basically, if we allow:

A getA() pure
{
    A a;        // line 7
    return a;   // NRVO
}

Doesn't that make NRVO a mandatory optimization? Wouldn't this be a problem?

@DmitryOlshansky
Copy link
Member

Doesn't that make NRVO a mandatory optimization? Wouldn't this be a problem?

It would be real nice in fact :) Finally everyone can absolutely count on it being done.

@9rnsr
Copy link
Contributor Author

9rnsr commented Oct 17, 2013

I replied in bugzilla: http://d.puremagic.com/issues/show_bug.cgi?id=11287#c2

In 2.064 development, all of NRVO handling were moved in front-end. So now it is testable in compile-time except the case in bug 11287.

I also think NRVO is one of the importand dmd feature, and the D specification should mention about it, because "create an object and move it to the caller" is necessary feature to extend the returned object lifetime.

@Dgame
Copy link

Dgame commented Nov 3, 2013

@WalterBright can this be merged?

WalterBright added a commit that referenced this pull request Nov 8, 2013
Issue 11286 - Impure dtor makes "cannot call impure function" error, although it won't actually be called.
@WalterBright WalterBright merged commit d9a2adb into dlang:master Nov 8, 2013
@9rnsr 9rnsr deleted the fix11286 branch November 8, 2013 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants