[PATCH] D120936: [Sema][Windows] Don't special-case void* in __unaligned conversions.

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 8 15:14:57 PST 2022


rnk added a comment.

I remember writing up feedback on this patch, but it's gone now, oh well.

I wasn't able to find any history for why `void*` was special here.

I see that MSVC doesn't warn when converting from `__unaligned int*` to `int*`, but that seems dangerous. Our team has an active feature request to tighten up clang warnings to make it harder to form unaligned pointers, so I'd like to insist that we warn when the `__unaligned` qualifier gets lost.



================
Comment at: clang/test/SemaCXX/MicrosoftExtensions.cpp:90
 
-  B_unaligned *p5 = p3; // expected-error {{cannot initialize a variable of type 'B_unaligned *' with an lvalue of type '__unaligned B_unaligned *'}}
+  B_unaligned *p5 = p3;
 
----------------
erichkeane wrote:
> MSVC is warning on this one, its a shame we don't have something similar.
I agree this is important, and I think it's a blocking issue. We don't want to allow new constructs, introduce a warning for them later, and then ask people to clean it up.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120936



More information about the cfe-commits mailing list