Author: Timm Baeder
Date: 2026-10-12T08:02:05+02:00
New Revision: f90c7894e4b79885c6936d8f04ba053070c44069

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

LOG: [clang][CUDA] Perform lvalue-to-rvalue conversion on `__cluster_dims__` 
attribute arguments (#227998)

A `ConstantExpr` with an lvalue subexpression should always have an
lvalue APValue result.

Added: 
    

Modified: 
    clang/lib/Sema/SemaDeclAttr.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 0361a362402bc..816ba1a1a7fa0 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -6212,7 +6212,11 @@ makeClusterDimsArgExpr(Sema &S, Expr *E, const 
CUDAClusterDimsAttr &AL,
     return {};
   }
 
-  return {ConstantExpr::Create(S.getASTContext(), E, APValue(*I)),
+  ExprResult Result = S.DefaultLvalueConversion(E);
+  if (!Result.isUsable())
+    return {};
+
+  return {ConstantExpr::Create(S.getASTContext(), Result.get(), APValue(*I)),
           I->getZExtValue()};
 }
 


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to