From 3b0de8b6ea484091146f61e663c63beeac5b4798 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 15 May 2024 18:07:36 -0700 Subject: Add diagnostic to prevent defining unsized variables. (#4168) * Add diagnostic to prevent defining unsized static variables. * Fix tests. * Add more tests. * Fix to allow defining variables of link-time size. * update diagnostic message. * Fix tests. * Simplify code. --- source/slang/slang-check-conformance.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-check-conformance.cpp') diff --git a/source/slang/slang-check-conformance.cpp b/source/slang/slang-check-conformance.cpp index a0e51b180..394d0693f 100644 --- a/source/slang/slang-check-conformance.cpp +++ b/source/slang/slang-check-conformance.cpp @@ -274,7 +274,8 @@ namespace Slang } else if (auto intVal = arrayType->getElementCount()) { - sized = !intVal->isLinkTimeVal(); + sized = true; + typeTag = (TypeTag)((int)typeTag | (int)TypeTag::LinkTimeSized); } if (!sized) typeTag = (TypeTag)((int)typeTag | (int)TypeTag::Unsized); -- cgit v1.2.3