[clang] [Clang] Change how the argument of a delete expression is converted (PR #92814)
Mital Ashok via cfe-commits
cfe-commits at lists.llvm.org
Mon May 20 12:46:41 PDT 2024
MitalAshok wrote:
The array-to-pointer conversion *is* necessary, even if it's impractical to use:
https://eel.is/c++draft/expr.delete#1.sentence-5
> Otherwise, it shall be a prvalue of pointer to object type.
https://eel.is/c++draft/basic.lval#6
> Whenever a glvalue appears as an operand of an operator that requires a prvalue for that operand, the lvalue-to-rvalue ([[conv.lval]](https://eel.is/c++draft/conv.lval)), array-to-pointer ([[conv.array]](https://eel.is/c++draft/conv.array)), or function-to-pointer ([[conv.func]](https://eel.is/c++draft/conv.func)) standard conversions are applied to convert the expression to a prvalue.
Deleting an array object will almost always be erroneous, which is why I've added the warning.
https://github.com/llvm/llvm-project/pull/92814
More information about the cfe-commits
mailing list