/// "int". However, it is not more qualified than "const volatile
/// int".
inline bool QualType::isMoreQualifiedThan(QualType Other) const {
- // FIXME: Handle address spaces
unsigned MyQuals = this->getCVRQualifiers();
unsigned OtherQuals = Other.getCVRQualifiers();
- assert(this->getAddressSpace() == 0 && "Address space not checked");
- assert(Other.getAddressSpace() == 0 && "Address space not checked");
+ if (getAddressSpace() != Other.getAddressSpace())
+ return false;
return MyQuals != OtherQuals && (MyQuals | OtherQuals) == MyQuals;
}
/// int" is at least as qualified as "const int", "volatile int",
/// "int", and "const volatile int".
inline bool QualType::isAtLeastAsQualifiedAs(QualType Other) const {
- // FIXME: Handle address spaces
unsigned MyQuals = this->getCVRQualifiers();
unsigned OtherQuals = Other.getCVRQualifiers();
- assert(this->getAddressSpace() == 0 && "Address space not checked");
- assert(Other.getAddressSpace() == 0 && "Address space not checked");
+ if (getAddressSpace() != Other.getAddressSpace())
+ return false;
return (MyQuals | OtherQuals) == MyQuals;
}
int x, y;
} s __attribute ((address_space(1))) = {1, 1};
+
+// rdar://6774906
+__attribute__((address_space(256))) void * * const base = 0;
+void * get_0(void) {
+ return base[0]; // expected-error {{illegal implicit cast between two pointers with different address spaces}} \
+ expected-warning {{returning 'void __attribute__((address_space(256)))*' discards qualifiers, expected 'void *'}}
+}
+