CWG2352: Allow qualification conversions during reference binding.
authorRichard Smith <richard@metafoo.co.uk>
Thu, 19 Dec 2019 19:15:47 +0000 (11:15 -0800)
committerRichard Smith <richard@metafoo.co.uk>
Fri, 20 Dec 2019 02:37:55 +0000 (18:37 -0800)
commitde21704ba96fa80d3e9402f12c6505917a3885f4
tree4c6f76c59c3367f408c4ab4c881a28cb150859a3
parenta77a290a4dbb1db2de4cf48c0599f8e3a3c86c53
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.
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaInit.cpp
clang/lib/Sema/SemaOverload.cpp
clang/test/CXX/drs/dr23xx.cpp
clang/test/CXX/drs/dr4xx.cpp
clang/test/SemaObjCXX/arc-overloading.mm
clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
clang/www/cxx_dr_status.html
clang/www/make_cxx_dr_status