Skip to content

Commit 22c7a6d

Browse files
committed
[objcxx] Fix std::addressof for id.
Differential Revision: https://reviews.llvm.org/D129384
1 parent 23c7328 commit 22c7a6d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

clang/lib/Sema/SemaChecking.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2413,7 +2413,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
24132413
bool ReturnsPointer = BuiltinID == Builtin::BIaddressof ||
24142414
BuiltinID == Builtin::BI__addressof;
24152415
if (!(Param->isReferenceType() &&
2416-
(ReturnsPointer ? Result->isPointerType()
2416+
(ReturnsPointer ? Result->isAnyPointerType()
24172417
: Result->isReferenceType()) &&
24182418
Context.hasSameUnqualifiedType(Param->getPointeeType(),
24192419
Result->getPointeeType()))) {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify %s
2+
// expected-no-diagnostics
3+
4+
namespace std {
5+
template <class T>
6+
T* addressof(T&);
7+
}
8+
9+
void f(id obj) {
10+
(void)std::addressof(*obj);
11+
}

0 commit comments

Comments
 (0)