]> granicus.if.org Git - clang/commit
Fix an assertion when ending a function definition.
authorJohn McCall <rjmccall@apple.com>
Tue, 18 Nov 2014 00:19:01 +0000 (00:19 +0000)
committerJohn McCall <rjmccall@apple.com>
Tue, 18 Nov 2014 00:19:01 +0000 (00:19 +0000)
commite89e1418ad1e8c62bd3609e8da2d5b07a12e6af3
tree936bad4ba43f8eaa82c93ac7e960a59642ae0092
parentf98071d4eacb44e7f36b4fd9878f415524a6efda
Fix an assertion when ending a function definition.

The bug is that ExprCleanupObjects isn't always empty
in a fresh evaluation context.  New evaluation contexts just
track the current depth of the stack.

The assertion will misfire whenever we finish processing
a function body inside an expression that contained an earlier
block literal with non-trivial captures.  That's actually
a lot less likely than you'd think, though, because it has
to be a real function declaration, not just another block.
Mixed block/lambda code would work, as would a template
instantiation or a local class definition.

The code works correctly if the assertion is disabled.

rdar://16356628

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222194 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaDecl.cpp
test/SemaCXX/blocks.cpp