[PATCH] D130123: Extend ptr32 support to be applied on typedef
Ariel Burton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 3 09:22:42 PDT 2022
Ariel-Burton added a comment.
In D130123#3691011 <https://reviews.llvm.org/D130123#3691011>, @rnk wrote:
> That sounds reasonable to me, I confirmed that MSVC really only lets you apply these attributes directly to pointer types and to typedefs.
>
> Can you add a test for the other most common type sugar node, the template parameter? It looks like this:
>
> template <typename T>
> void f(T __ptr32 a) {
> (*a) += 1;
> }
> void g(int *p) {
> f(p);
> }
>
> If there isn't already a C++ test for __ptr32 & co, go ahead and make one.
What is your expectation for your template code fragment? MSVC does not accept it.
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);
}
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130123/new/
https://reviews.llvm.org/D130123
More information about the cfe-commits
mailing list