Hi All, In PR 12746 a failing assertion was reported when mixing blocks and lambdas. The original reproduction case looked something like:
void foo(int *x)
{
^() {
[&]() {
return x == 0;
}();
}();
}
The following assert in 'clang::CodeGenFunction::EmitDeclRefLValue' was failing
because the variable declaration referenced in 'E' was not in the 'LocalDeclMap'
and was not marked as referring to an enclosing local:
assert(isa<BlockDecl>(CurCodeDecl) && E->refersToEnclosingLocal());
This problem has been fixed by ensuring that the 'DeclRefExpr' gets marked as
referring to an enclosing local as it should be.
While investigating this issue I noticed that the reverse nesting fails too,
but for a different reason:
void foo(int *x)
{
[&]() {
^() {
return x == 0;
}();
}();
}
This time 'clang::CodeGen::CodeGenFunction::EmitBlockLiteral' goes to lookup
the capture information for the nested parameter 'x', but crashes because it
is actually nested in a lambda and the 'BlockInfo' is NULL. This was fixed by
adding a check to ensure 'BlockInfo' is not NULL.
OK?
-- Meador
P.S. If it is OK, then can someone commit for me? (I don't have
commit rights.)
pr12746.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
