[clang] [HLSL] Reject unbounded resource array and noinline function resource parameters (PR #208111)

Helena Kotas via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 9 12:56:02 PDT 2026


================
@@ -15770,11 +15788,17 @@ Decl *Sema::ActOnParamDeclarator(Scope *S, Declarator &D,
   }
 
   // Incomplete resource arrays are not allowed as function parameters in HLSL
-  if (getLangOpts().HLSL && parmDeclType->isIncompleteArrayType() &&
-      parmDeclType->isHLSLResourceRecordArray()) {
-    Diag(D.getIdentifierLoc(),
-         diag::err_hlsl_incomplete_resource_array_in_function_param);
-    D.setInvalidType(true);
+  if (getLangOpts().HLSL && parmDeclType->isIncompleteArrayType()) {
+    QualType EltTy = Context.getBaseElementType(parmDeclType);
+    // `isCompleteType` forces completion of the element type so the resource
----------------
hekota wrote:

Go it. We don't allow unbounded arrays as function parameters anymore, but you are right that this code should work if the array has a fixed size.  

https://github.com/llvm/llvm-project/pull/208111


More information about the cfe-commits mailing list