[PATCH] D103962: [C++4OpenCL] Fix qualifiers check on binding references to temporaries

Ole Strohm via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 9 06:07:18 PDT 2021


olestrohm created this revision.
olestrohm added reviewers: Anastasia, svenvh.
olestrohm added a project: clang.
Herald added subscribers: ldrumm, yaxunl.
olestrohm requested review of this revision.
Herald added a subscriber: cfe-commits.

Fixing the qualifiers check from PR49733.

It would be great to add some test, to increase the coverage, and because the erroneous check doesn't seem to trigger in any tests.
However I couldn't come up with a case that did trigger it, so it may be that it can't happen, or at least is very unlikely.

Fixes: PR49733


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103962

Files:
  clang/lib/Sema/SemaInit.cpp


Index: clang/lib/Sema/SemaInit.cpp
===================================================================
--- clang/lib/Sema/SemaInit.cpp
+++ clang/lib/Sema/SemaInit.cpp
@@ -5063,9 +5063,9 @@
   //        than, cv2; otherwise, the program is ill-formed.
   unsigned T1CVRQuals = T1Quals.getCVRQualifiers();
   unsigned T2CVRQuals = T2Quals.getCVRQualifiers();
-  if ((RefRelationship == Sema::Ref_Related &&
-       (T1CVRQuals | T2CVRQuals) != T1CVRQuals) ||
-      !T1Quals.isAddressSpaceSupersetOf(T2Quals)) {
+  if (RefRelationship == Sema::Ref_Related &&
+      ((T1CVRQuals | T2CVRQuals) != T1CVRQuals ||
+       !T1Quals.isAddressSpaceSupersetOf(T2Quals))) {
     Sequence.SetFailed(InitializationSequence::FK_ReferenceInitDropsQualifiers);
     return;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103962.350872.patch
Type: text/x-patch
Size: 763 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210609/a7987c5b/attachment-0001.bin>


More information about the cfe-commits mailing list