[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 19:27:34 PDT 2022
Ariel-Burton added a comment.
In D130123#3696786 <https://reviews.llvm.org/D130123#3696786>, @rnk wrote:
> 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.
Thanks.
Just to make sure that we're on the same page, you'd like to see a test that confirms that clang is rejecting the `template<typename T> void f(T __ptr32 a)` example, and possibly one that checks that my example is accepted. Is that correct?
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