[clang] 78d309c - [OpenCL] Fix qualifiers check on binding references to temporaries

Ole Strohm via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 29 02:04:22 PDT 2021


Author: Ole Strohm
Date: 2021-06-29T10:03:57+01:00
New Revision: 78d309ce197c30593450e792b0c2dc7a575f0050

URL: https://github.com/llvm/llvm-project/commit/78d309ce197c30593450e792b0c2dc7a575f0050
DIFF: https://github.com/llvm/llvm-project/commit/78d309ce197c30593450e792b0c2dc7a575f0050.diff

LOG: [OpenCL] Fix qualifiers check on binding references to temporaries

Fix the qualifiers check from PR49733.

Fixes: PR49733

Reviewed By: Anastasia

Differential Revision: https://reviews.llvm.org/D103962

Added: 
    

Modified: 
    clang/lib/Sema/SemaInit.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index f916299e4f560..240188f60592b 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -5065,9 +5065,9 @@ static void TryReferenceInitializationCore(Sema &S,
   //        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;
   }


        


More information about the cfe-commits mailing list