[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
Tue May 21 06:51:21 PDT 2024


================
@@ -1245,12 +1245,7 @@ namespace cwg599 { // cwg599: partial
     // expected-error at -1 {{cannot delete expression with pointer-to-'void' type 'void *'}}
     delete t;
     // expected-error at -1 {{cannot delete expression of type 'T'}}
-    // FIXME: This is valid, but is rejected due to a non-conforming GNU
-    // extension allowing deletion of pointers to void.
     delete u;
-    // expected-error at -1 {{ambiguous conversion of delete expression of type 'U' to a pointer}}
----------------
MitalAshok wrote:

@Endilll There is a set of appropriate types (for `delete`, it's all pointer-to-object types), and there must be exactly one `T` in that set where there is a conversion operator to cv-`T` or reference to cv-`T`. So for `delete u;`, the search finds `T = int*`, so `u` is contextually implicitly converted to `int*`. See also: <https://eel.is/c++draft/conv.general#5> <https://wg21.link/N3323>

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


More information about the cfe-commits mailing list