zoecarver created this revision. Herald added a project: All. zoecarver requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D129384 Files: clang/lib/Sema/SemaChecking.cpp clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm Index: clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm =================================================================== --- /dev/null +++ clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify %s +// expected-no-diagnostics + +namespace std { + template <class T> + T* addressof(T&); +} + +void f(id obj) { + (void)std::addressof(*obj); +} Index: clang/lib/Sema/SemaChecking.cpp =================================================================== --- clang/lib/Sema/SemaChecking.cpp +++ clang/lib/Sema/SemaChecking.cpp @@ -2413,7 +2413,7 @@ bool ReturnsPointer = BuiltinID == Builtin::BIaddressof || BuiltinID == Builtin::BI__addressof; if (!(Param->isReferenceType() && - (ReturnsPointer ? Result->isPointerType() + (ReturnsPointer ? Result->isAnyPointerType() : Result->isReferenceType()) && Context.hasSameUnqualifiedType(Param->getPointeeType(), Result->getPointeeType()))) {
Index: clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm =================================================================== --- /dev/null +++ clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify %s +// expected-no-diagnostics + +namespace std { + template <class T> + T* addressof(T&); +} + +void f(id obj) { + (void)std::addressof(*obj); +} Index: clang/lib/Sema/SemaChecking.cpp =================================================================== --- clang/lib/Sema/SemaChecking.cpp +++ clang/lib/Sema/SemaChecking.cpp @@ -2413,7 +2413,7 @@ bool ReturnsPointer = BuiltinID == Builtin::BIaddressof || BuiltinID == Builtin::BI__addressof; if (!(Param->isReferenceType() && - (ReturnsPointer ? Result->isPointerType() + (ReturnsPointer ? Result->isAnyPointerType() : Result->isReferenceType()) && Context.hasSameUnqualifiedType(Param->getPointeeType(), Result->getPointeeType()))) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits