forked from OSchip/llvm-project
[objcxx] Fix `std::addressof` for `id`.
Differential Revision: https://reviews.llvm.org/D129384
This commit is contained in:
parent
23c7328bad
commit
22c7a6dddd
|
@ -2413,7 +2413,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
|
|||
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()))) {
|
||||
|
|
|
@ -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);
|
||||
}
|
Loading…
Reference in New Issue