summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-stmt.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-04-04 15:29:36 -0700
committerGitHub <noreply@github.com>2023-04-04 15:29:36 -0700
commit492c6f2fd1a64c9d60a968b55bfd1000cc2ae8e7 (patch)
tree2fa6849e2b0228d7cede69f5ac5445b1d543fa01 /source/slang/slang-check-stmt.cpp
parent68c7d5cda2d6f2eb7bfb3a7e15860eb3ded25424 (diff)
Diagnose on using assignment as predicate expr. (#2774)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-check-stmt.cpp')
-rw-r--r--source/slang/slang-check-stmt.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/slang/slang-check-stmt.cpp b/source/slang/slang-check-stmt.cpp
index bc89dc94e..a61f48af6 100644
--- a/source/slang/slang-check-stmt.cpp
+++ b/source/slang/slang-check-stmt.cpp
@@ -151,6 +151,10 @@ namespace Slang
Expr* SemanticsVisitor::checkPredicateExpr(Expr* expr)
{
+ if (as<AssignExpr>(expr))
+ {
+ getSink()->diagnose(expr, Diagnostics::assignmentInPredicateExpr);
+ }
Expr* e = expr;
e = CheckTerm(e);
e = coerce(m_astBuilder->getBoolType(), e);