summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaObjCXX
diff options
context:
space:
mode:
authorRichard Smith <richard@metafoo.co.uk>2019-12-19 11:15:47 -0800
committerRichard Smith <richard@metafoo.co.uk>2019-12-19 18:37:55 -0800
commitde21704ba96fa80d3e9402f12c6505917a3885f4 (patch)
tree4c6f76c59c3367f408c4ab4c881a28cb150859a3 /clang/test/SemaObjCXX
parenta77a290a4dbb1db2de4cf48c0599f8e3a3c86c53 (diff)
downloadbcm5719-llvm-de21704ba96fa80d3e9402f12c6505917a3885f4.tar.gz
bcm5719-llvm-de21704ba96fa80d3e9402f12c6505917a3885f4.zip
CWG2352: Allow qualification conversions during reference binding.
The language wording change forgot to update overload resolution to rank implicit conversion sequences based on qualification conversions in reference bindings. The anticipated resolution for that oversight is implemented here -- we order candidates based on qualification conversion, not only on top-level cv-qualifiers. For OpenCL/C++, this allows reference binding between pointers with differing (nested) address spaces. This makes the behavior of reference binding consistent with that of implicit pointer conversions, as is the purpose of this change, but that pre-existing behavior for pointer conversions is itself probably not correct. In any case, it's now consistently the same behavior and implemented in only one place.
Diffstat (limited to 'clang/test/SemaObjCXX')
-rw-r--r--clang/test/SemaObjCXX/arc-overloading.mm30
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/test/SemaObjCXX/arc-overloading.mm b/clang/test/SemaObjCXX/arc-overloading.mm
index 3ac9c51293b..910b5c7be97 100644
--- a/clang/test/SemaObjCXX/arc-overloading.mm
+++ b/clang/test/SemaObjCXX/arc-overloading.mm
@@ -174,6 +174,36 @@ void test_f9() {
const __autoreleasing id& ar4 = weak_a;
}
+int &f10(__strong id *&); // expected-note 2{{not viable: no known conversion}}
+float &f10(__autoreleasing id *&); // expected-note 2{{not viable: no known conversion}}
+
+void test_f10() {
+ __strong id *strong_id;
+ __weak id *weak_id;
+ __autoreleasing id *autoreleasing_id;
+ __unsafe_unretained id *unsafe_id;
+
+ int &ir1 = f10(strong_id);
+ float &fr1 = f10(autoreleasing_id);
+ float &fr2 = f10(unsafe_id); // expected-error {{no match}}
+ float &fr2a = f10(weak_id); // expected-error {{no match}}
+}
+
+int &f11(__strong id *const &); // expected-note {{not viable: 1st argument ('__weak id *') has __weak ownership, but parameter has __strong ownership}}
+float &f11(const __autoreleasing id *const &); // expected-note {{not viable: 1st argument ('__weak id *') has __weak ownership, but parameter has __autoreleasing ownership}}
+
+void test_f11() {
+ __strong id *strong_id;
+ __weak id *weak_id;
+ __autoreleasing id *autoreleasing_id;
+ __unsafe_unretained id *unsafe_id;
+
+ int &ir1 = f11(strong_id);
+ float &fr1 = f11(autoreleasing_id);
+ float &fr2 = f11(unsafe_id);
+ float &fr2a = f11(weak_id); // expected-error {{no match}}
+}
+
// rdar://9790531
void f9790531(void *inClientData); // expected-note {{candidate function not viable: cannot implicitly convert argument of type 'MixerEQGraphTestDelegate *const __strong' to 'void *' for 1st argument under ARC}}
void f9790531_1(struct S*inClientData); // expected-note {{candidate function not viable}}
OpenPOWER on IntegriCloud