https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69850
--- Comment #6 from Markus Trippelsdorf <trippels at gcc dot gnu.org> --- Created attachment 37728 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37728&action=edit unreduced testcase trippels@gcc2-power8 llvm_build % g++ -Wnonnull-compare -Werror -c VariantValue.ii In file included from /home/trippels/llvm/tools/clang/include/clang/Basic/DiagnosticIDs.h:19:0, from /home/trippels/llvm/tools/clang/include/clang/Basic/Diagnostic.h:18, from /home/trippels/llvm/tools/clang/include/clang/Basic/PartialDiagnostic.h:19, from /home/trippels/llvm/tools/clang/include/clang/AST/DeclarationName.h:17, from /home/trippels/llvm/tools/clang/include/clang/AST/DeclBase.h:18, from /home/trippels/llvm/tools/clang/include/clang/AST/Decl.h:18, from /home/trippels/llvm/tools/clang/include/clang/AST/ASTTypeTraits.h:20, from /home/trippels/llvm/tools/clang/include/clang/AST/ASTContext.h:18, from /home/trippels/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers.h:48, from /home/trippels/llvm/tools/clang/include/clang/ASTMatchers/Dynamic/VariantValue.h:20, from /home/trippels/llvm/tools/clang/lib/ASTMatchers/Dynamic/VariantValue.cpp:15: /home/trippels/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In member function ‘void llvm::RefCountedBaseVPTR::Release() const’: /home/trippels/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:79:38: error: nonnull argument ‘this’ compared to NULL [-Werror=nonnull-compare] if (--ref_cnt == 0) delete this; ^ cc1plus: all warnings being treated as errors