as Discussed:
https://discourse.llvm.org/t/rfc-can-we-stop-the-extension-to-allow-dereferencing-void-in-c/65708
There is no good reason to allow this when the other compilers all
reject this, and it messes with SFINAE/constraint checking.
Paths
| Differential D135287
Disallow dereferencing of void* in C++. ClosedPublic Authored by erichkeane on Oct 5 2022, 10:21 AM.
Details
Summary as Discussed: There is no good reason to allow this when the other compilers all
Diff Detail
Event Timeline
Comment Actions
Yes, that would also be an error in C++, as it is on all other compilers. This revision is now accepted and ready to land.Oct 5 2022, 5:27 PM erichkeane marked an inline comment as done. Comment Actionsfix the release note spelling of permanent. Comment Actions
This actually relates to a use case I brought up in the RFC -- in an unevaluated context where the expression is only used to determine a type, it doesn't seem particularly harmful to allow the dereference. There might be generic programming cases where this comes up for people who exclusively use Clang, but I'm not 100% certain.
erichkeane added inline comments. This revision was landed with ongoing or failed builds.Oct 10 2022, 7:11 AM Closed by commit rG6685e56ceddf: Disallow dereferencing of void* in C++. (authored by erichkeane). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 466493 clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaExpr.cpp
clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1inst.cpp
clang/test/SemaCXX/disallow_void_deref.cpp
clang/test/SemaCXX/reinterpret-cast.cpp
|