diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-check-expr.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp index 6b1ab13cc..e8384e0ab 100644 --- a/source/slang/slang-check-expr.cpp +++ b/source/slang/slang-check-expr.cpp @@ -871,6 +871,13 @@ namespace Slang return getIntVal(intLitExpr); } + if (auto boolLitExpr = expr.as<BoolLiteralExpr>()) + { + // If it's a boolean, we allow promotion to int. + const IntegerLiteralValue value = IntegerLiteralValue(boolLitExpr.getExpr()->value); + return m_astBuilder->create<ConstantIntVal>(value); + } + // it is possible that we are referring to a generic value param if (auto declRefExpr = expr.as<DeclRefExpr>()) { |
