From d10ca980c3d84e4838272f2082e8e35f3a7e50c0 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Tue, 30 Nov 2021 17:09:52 -0500 Subject: Fix issue around constant folding/bool (#2036) * #include an absolute path didn't work - because paths were taken to always be relative. * Fix bool handling in constant folding for generic parameters. --- source/slang/slang-check-expr.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source') 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()) + { + // If it's a boolean, we allow promotion to int. + const IntegerLiteralValue value = IntegerLiteralValue(boolLitExpr.getExpr()->value); + return m_astBuilder->create(value); + } + // it is possible that we are referring to a generic value param if (auto declRefExpr = expr.as()) { -- cgit v1.2.3