[clang] [Clang][Sema] Reject array prvalue operands (PR #140702)

via cfe-commits cfe-commits at lists.llvm.org
Tue May 20 20:03:24 PDT 2025


================
@@ -15840,6 +15859,11 @@ ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc,
       InputExpr->getType()->isSpecificBuiltinType(BuiltinType::Dependent)) {
     resultType = Context.DependentTy;
   } else {
+    if (Opc == UO_Deref || Opc == UO_Plus) {
----------------
Sirraide wrote:

It feels a bit weird to use an `if` statement here when there’s a `switch` statement on the same variable right after. I’d probably make this a lambda and then call it in the cases for `*` and `+` below (the `+` case would then also need a `[[fallthrough]]` annotation).

https://github.com/llvm/llvm-project/pull/140702


More information about the cfe-commits mailing list