ObjC++ has two different types of "pointer" types (ObjCClassPointerType
and PointerType). Both can be indirected through. However, the former
is not a member expression. Ensure that we do not try to rebuild the
MRE in that case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300909
91177308-0d34-0410-b5e6-
96231b3b80d8
Base = BaseResult.get();
QualType BaseType = Base->getType();
+ if (isArrow && !BaseType->isPointerType())
+ return ExprError();
+
// FIXME: this involves duplicating earlier analysis in a lot of
// cases; we should avoid this when possible.
LookupResult R(getSema(), MemberNameInfo, Sema::LookupMemberName);
--- /dev/null
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify -x objective-c++ %s -o /dev/null
+// REQUIRES: asserts
+
+struct objc_class {
+ unsigned long long bits;
+};
+typedef struct objc_class *Class;
+static void f(Class c) { (void)(c->bits & RW_HAS_OVERFLOW_REFCOUNT); }
+// expected-error@-1{{use of undeclared identifier 'RW_HAS_OVERFLOW_REFCOUNT}}