[clang] [HLSL] Convert vectors to bool for unary ! (PR #163857)
Farzon Lotfi via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 16 14:26:48 PDT 2025
================
@@ -15944,6 +15944,20 @@ ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc,
return ExprError(Diag(OpLoc, diag::err_typecheck_unary_expr)
<< resultType << Input.get()->getSourceRange());
}
+ } else if (Context.getLangOpts().HLSL && resultType->isVectorType() &&
+ !resultType->hasBooleanRepresentation()) {
+ // HLSL unary logical not behaves like C++, which states that the
+ // operand is onverted to bool and the result is bool, however HLSL
----------------
farzonl wrote:
```suggestion
// operand is converted to bool and the result is bool, however HLSL
```
https://github.com/llvm/llvm-project/pull/163857
More information about the cfe-commits
mailing list