diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp --- a/clang/lib/Sema/AnalysisBasedWarnings.cpp +++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp @@ -2403,7 +2403,7 @@ } // Check for violations of "called once" parameter properties. - if (S.getLangOpts().ObjC && + if (S.getLangOpts().ObjC && !S.getLangOpts().CPlusPlus && shouldAnalyzeCalledOnceParameters(Diags, D->getBeginLoc())) { if (AC.getCFG()) { CalledOnceCheckReporter Reporter(S, IPData->CalledOnceData); diff --git a/clang/test/SemaObjCXX/warn-called-once.mm b/clang/test/SemaObjCXX/warn-called-once.mm --- a/clang/test/SemaObjCXX/warn-called-once.mm +++ b/clang/test/SemaObjCXX/warn-called-once.mm @@ -1,7 +1,13 @@ -// RUN: %clang_cc1 -verify -fsyntax-only -Wcompletion-handler %s +// RUN: %clang_cc1 -verify -fsyntax-only -fblocks -Wcompletion-handler %s // expected-no-diagnostics class HasCtor { HasCtor(void *) {} }; + +void double_call_one_block(void (^completionHandler)(void)) { + completionHandler(); + completionHandler(); + // no-warning - we don't support C++/Obj-C++ yet +}