summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Smith <richard@metafoo.co.uk>2020-01-09 19:24:44 -0800
committerRichard Smith <richard@metafoo.co.uk>2020-01-10 16:12:00 -0800
commit9a6f4d451ca7aa06b94a407015fbadb456bc09ef (patch)
tree6a943c79679de34b1828311f1085f396cc417718 /clang/test
parentfbf915f01d46e005146f01553a5d7c6619d19597 (diff)
downloadbcm5719-llvm-9a6f4d451ca7aa06b94a407015fbadb456bc09ef.tar.gz
bcm5719-llvm-9a6f4d451ca7aa06b94a407015fbadb456bc09ef.zip
Clean up and slightly generalize implementation of composite pointer
type computation, in preparation for P0388R4, which adds another few cases here. We now properly handle forming multi-level composite pointer types involving nested Objective-C pointer types (as is consistent with including them as part of the notion of 'similar types' on which this rule is based). We no longer lose non-CVR qualifiers on nested pointer types.
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaObjCXX/composite-objc-pointertype.mm10
-rw-r--r--clang/test/SemaOpenCLCXX/address-space-cond.cl23
2 files changed, 33 insertions, 0 deletions
diff --git a/clang/test/SemaObjCXX/composite-objc-pointertype.mm b/clang/test/SemaObjCXX/composite-objc-pointertype.mm
index 35739a89362..64cdc2c8147 100644
--- a/clang/test/SemaObjCXX/composite-objc-pointertype.mm
+++ b/clang/test/SemaObjCXX/composite-objc-pointertype.mm
@@ -17,3 +17,13 @@
}
@end
+@class A;
+
+void multilevel() {
+ A **p;
+ const A **q;
+
+ using T = decltype(true ? q : p);
+ using T = const A * const *;
+}
+
diff --git a/clang/test/SemaOpenCLCXX/address-space-cond.cl b/clang/test/SemaOpenCLCXX/address-space-cond.cl
new file mode 100644
index 00000000000..80905989200
--- /dev/null
+++ b/clang/test/SemaOpenCLCXX/address-space-cond.cl
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 %s -cl-std=clc++ -pedantic -verify
+
+namespace PointerRvalues {
+
+void f(__global int *__constant *a, const __global int *__constant *b) {
+ using T = decltype(true ? +a : +b);
+ using T = const __global int *const __constant *;
+}
+
+void g(const __global int *a, __generic int *b) {
+ using T = decltype(true ? +a : +b);
+ using T = const __generic int *;
+}
+
+void h(const __global int **a, __generic int **b) {
+ using T = decltype(true ? +a : +b); // expected-error {{incompatible operand types}}
+}
+
+void i(__global int **a, __generic int **b) {
+ using T = decltype(true ? +a : +b); // expected-error {{incompatible operand types}}
+}
+
+}
OpenPOWER on IntegriCloud