[clang] More fixes for P3144R2 implementation (PR #149406)

Harald van Dijk via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 18 08:38:29 PDT 2025


================
@@ -8392,17 +8392,19 @@ def ext_default_init_const : ExtWarn<
   "is a Microsoft extension">,
   InGroup<MicrosoftConstInit>;
 def err_delete_operand : Error<"cannot delete expression of type %0">;
+def err_delete_void_ptr_operand : Error<
+  "cannot delete expression with pointer-to-'void' type %0">;
 def ext_delete_void_ptr_operand : ExtWarn<
   "cannot delete expression with pointer-to-'void' type %0">,
   InGroup<DeleteIncomplete>;
 def err_ambiguous_delete_operand : Error<
   "ambiguous conversion of delete expression of type %0 to a pointer">;
 def warn_delete_incomplete : Warning<
-  "deleting pointer to incomplete type %0 is incompatible with C++2c"
+  "deleting pointer to incomplete %select{struct|union}0 %1 is incompatible with C++2c"
----------------
hvdijk wrote:

A diagnostic referring to a union `U` as "struct 'U'" or "class 'U'" would be misleading. Although they are class types, the `struct` or `class` keyword cannot be used for them. `%select{struct|union}` is used in other diagnostics to avoid confusion, e.g. `"%select{struct|union}0 kernel parameters may not contain pointers"`.

But I see in yet other places that it's making sure to use either `struct` or `class` depending on what the user wrote. That would likely be even clearer for users, so will update.

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


More information about the cfe-commits mailing list