[PATCH] D130123: Extend ptr32 support to be applied on typedef

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 3 09:31:17 PDT 2022

rnk added a comment.

In D130123#3696752 <https://reviews.llvm.org/D130123#3696752>, @Ariel-Burton wrote:

> What is your expectation for your template code fragment?  MSVC does not accept it.

Yes, I checked, MSVC rejects it, so clang should have test expectations to confirm that. It seems interesting or surprising, to me at least, that MSVC really only accepts __ptr32 on pointers and typedefs of them.

> On the other hand, MSVC does accept this:
>   template <typename T>
>   void f(T  a) {
>     (*a) += sizeof(a);
>   }
>   void g(int *p) {
>     f(p);
>   }
>   void h(int *__ptr32 p) {
>       f(p);
>   }

Right, this makes sense to me. MSVC's diagnostics say something about the __ptr32 qualifier needing to appear after a `*`, so this extension must be implemented at a pretty low-level, with some exception for typedefs, just like what you have.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list