diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -6552,12 +6552,16 @@ // FIXME: In C, we merge __strong and none to __strong at the top level. if (Q1.getObjCGCAttr() == Q2.getObjCGCAttr()) Quals.setObjCGCAttr(Q1.getObjCGCAttr()); + else if (T1->isVoidPointerType() || T2->isVoidPointerType()) + assert(Steps.size() == 1); else return QualType(); // Mismatched lifetime qualifiers never compatibly include each other. if (Q1.getObjCLifetime() == Q2.getObjCLifetime()) Quals.setObjCLifetime(Q1.getObjCLifetime()); + else if (T1->isVoidPointerType() || T2->isVoidPointerType()) + assert(Steps.size() == 1); else return QualType(); diff --git a/clang/test/SemaObjCXX/arc-ptr-comparison.mm b/clang/test/SemaObjCXX/arc-ptr-comparison.mm --- a/clang/test/SemaObjCXX/arc-ptr-comparison.mm +++ b/clang/test/SemaObjCXX/arc-ptr-comparison.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -verify %s +// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -verify %s // RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin11 -fsyntax-only -verify -DNOARC %s #ifdef NOARC // expected-no-diagnostics @@ -51,3 +51,17 @@ return a == cv; return ca == v; } + +#ifndef NOARC +int testDoublePtr(void *pv, void **ppv, A *__strong* pspa, A *__weak* pwpa, A *__strong** ppspa) { + return pv == pspa; + return pspa == pv; + return pv == pspa; + return pv == pwpa; + return pspa == pwpa; // expected-error {{comparison of distinct pointer types}} + return ppv == pspa; // expected-error {{comparison of distinct pointer types}} + return pspa == ppv; // expected-error {{comparison of distinct pointer types}} + return pv == ppspa; + return ppv == ppspa; // expected-error{{comparison of distinct pointer types}} +} +#endif