[PATCH] D150875: Make dereferencing a void* a hard-error instead of warn-as-error

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 18 10:33:05 PDT 2023


erichkeane added a comment.



In D150875#4353535 <https://reviews.llvm.org/D150875#4353535>, @rsmith wrote:

> In D150875#4353384 <https://reviews.llvm.org/D150875#4353384>, @erichkeane wrote:
>
>> We are the only of the major compilers with this "extension" (I hesitate to call it that, as I'm not sure this FITS in the 'extension's permitted by standard)
>
> I'm not objecting to removing this extension, but... do you have reason to doubt that it's conforming, or just a lack of confidence that it is? (If the `SFINAEFailure` change wasn't enough, then it's not clear to me why this change would be. We use a `SFINAEFailure` diagnostic for other extensions, and if that's not sufficient for conformance then we probably have a lot of conformance gaps of this kind.)

No, just lack of confidence.  I guess if it is supposed to be ill-formed, we can permit it (except in SFINAE?), right?  The intent here is mostly just for 'cleanup' as we see it.



================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:6985
+def err_typecheck_indirection_through_void_pointer_cpp
+    : Error<"ISO C++ does not allow indirection on operand of type %0">;
 def warn_indirection_through_null : Warning<
----------------
rsmith wrote:
> We normally only use this "ISO C++ does not allow" phrasing for extensions (with the implication being that ISO C++ doesn't allow it, but Clang does). Can you rephrase the diagnostic too, to remove those unnecessary words?
I definitely can.  Though, I wonder if we can just use the err_typecheck_indirection_requires_pointer above instead and remove this diagnostic?  We might need to change that to `indirection requires non-void pointer operand (%0 invalid)`.  WDYT?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150875/new/

https://reviews.llvm.org/D150875



More information about the cfe-commits mailing list