fix rdar://6774906, a crash handling implicit conversions between pointers
in different address spaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68941 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/address_spaces.c b/test/Sema/address_spaces.c
index 8f63726..b79799f 100644
--- a/test/Sema/address_spaces.c
+++ b/test/Sema/address_spaces.c
@@ -22,3 +22,11 @@
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 *'}}
+}
+