From b5f4cf63a8b952731053a0d04af0fc8c946d86f3 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 2 Apr 2024 11:51:36 -0700 Subject: Allow enum values to be used as generic arguments. (#3874) * Allow enum values to be used as generic arguments. * Fix constant folding. --- source/slang/slang-check-decl.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/slang/slang-check-decl.cpp') diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index 07c8b0cba..aec3b463b 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -5946,6 +5946,11 @@ namespace Slang return isIntegerBaseType(baseType) || baseType == BaseType::Bool; } + bool SemanticsVisitor::isValidCompileTimeConstantType(Type* type) + { + return isScalarIntegerType(type) || isEnumType(type); + } + bool SemanticsVisitor::isIntValueInRangeOfType(IntegerLiteralValue value, Type* type) { auto basicType = as(type); -- cgit v1.2.3