summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-decl.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-02-09 22:00:15 -0800
committerGitHub <noreply@github.com>2024-02-09 22:00:15 -0800
commit20ab16178e45d07b4dc0104a7a98865d18440b62 (patch)
tree5314057a48d5ad2346fa808e4cfacff0991ce9b9 /source/slang/slang-check-decl.cpp
parentf44da6cc5c0f211c13bd1eb0743d79c7861ea64e (diff)
Support link-time constants. (#3564)
* Support link-time constants. * Fix. * Fix.
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
-rw-r--r--source/slang/slang-check-decl.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp
index 3882994da..2a6ee8abc 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -1471,6 +1471,11 @@ namespace Slang
}
else
{
+ if (varDecl->hasModifier<ExternModifier>())
+ {
+ getSink()->diagnose(initExpr, Diagnostics::externValueCannotHaveInitializer);
+ }
+
initExpr = CheckExpr(initExpr);
// TODO: We might need some additional steps here to ensure
@@ -1484,7 +1489,7 @@ namespace Slang
_validateCircularVarDefinition(varDecl);
}
-
+
// If we've gone down this path, then the variable
// declaration is actually pretty far along in checking
varDecl->setCheckState(DeclCheckState::DefinitionChecked);