diff options
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
| -rw-r--r-- | source/slang/slang-check-decl.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index d6bc50b82..72b5c19db 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -2187,6 +2187,10 @@ void SemanticsDeclHeaderVisitor::checkVarDeclCommon(VarDeclBase* varDecl) // arrays in specific cases) // validateArraySizeForVariable(varDecl); + // + // Similarly, we want to check the element type for any restrictions + // + validateArrayElementTypeForVariable(varDecl); } // If there is a matrix layout modifier or texture format modifier, we will modify the type now. @@ -10745,6 +10749,20 @@ void SemanticsVisitor::validateArraySizeForVariable(VarDeclBase* varDecl) } } +void SemanticsVisitor::validateArrayElementTypeForVariable(VarDeclBase* varDecl) +{ + auto arrayType = as<ArrayExpressionType>(varDecl->type); + if (!arrayType) + return; + + const auto elementType = arrayType->getElementType(); + if (as<ParameterBlockType>(elementType)) + { + getSink()->diagnose(varDecl, Diagnostics::disallowedArrayOfParameterBlock); + return; + } +} + bool getExtensionTargetDeclList( ASTBuilder* astBuilder, DeclRefType* targetDeclRefType, |
