summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-check-decl.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp
index 71aa71e69..cc65edd2f 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -2464,6 +2464,17 @@ bool DiagnoseIsAllowedInitExpr(VarDeclBase* varDecl, DiagnosticSink* sink)
return false;
}
+ if (as<InterfaceDecl>(varDecl->parentDecl))
+ {
+ if (sink && varDecl->initExpr)
+ sink->diagnose(
+ varDecl,
+ Diagnostics::cannotHaveInitializer,
+ varDecl,
+ "an interface requirement");
+ return false;
+ }
+
return true;
}