forked from OSchip/llvm-project
[Sema][ObjC] Don't warn about implicitly-retained self in an unevaluated
context
This commit is contained in:
parent
ced705c440
commit
5d794552bc
|
@ -2946,7 +2946,7 @@ ExprResult Sema::BuildIvarRefExpr(Scope *S, SourceLocation Loc,
|
|||
!Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, Loc))
|
||||
getCurFunction()->recordUseOfWeak(Result);
|
||||
}
|
||||
if (getLangOpts().ObjCAutoRefCount)
|
||||
if (getLangOpts().ObjCAutoRefCount && !isUnevaluatedContext())
|
||||
if (const BlockDecl *BD = CurContext->getInnermostBlockDecl())
|
||||
ImplicitlyRetainedSelfLocs.push_back({Loc, BD});
|
||||
|
||||
|
|
|
@ -39,4 +39,8 @@ void escapeFunc(BlockTy);
|
|||
noescapeFunc(^{ [&](){ (void)_bar; }(); });
|
||||
escapeFunc(^{ [&](){ (void)_bar; }(); }); // expected-warning {{block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior}}
|
||||
}
|
||||
|
||||
- (BlockTy)testDeclType{
|
||||
return ^{ decltype(_bar) i = 12; (void)i; };
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue