On Jul 11, 2012, at 8:35 AM, Nico Weber wrote:
> the attached patch fixes PR13314, clang crashing on code like this:
>
> void f() {
> Foo foo;
> [=]() {
> return foo;
> };
> }
>
> This crash was introduced in r152491, which replaced BlockDeclRefExpr
> with a bit on DeclRefExpr. getCopyElisionCandidate() wasn't taught
> about the new bit, so the the `return foo;` in the closure marks `foo`
> as a NRVO candidate, but codegen for f() then looks at the return type
> of f for NRVO. Since the function returns void, this results in a
> failing assert somewhere down the line (see the bug for more details).
> The attached patch makes getCopyElisionCandidate() ignore DeclRefExprs
> that return to enclosing locals, which is I believe what happened
> before r152491 too.
>
> Ok?
Looks good, thanks!
John.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits