================ @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -verify -fptrauth-intrinsics -std=c++11 %s +// RUN: %clang_cc1 -triple aarch64-linux-gnu -fsyntax-only -verify -fptrauth-intrinsics -std=c++11 %s + +template <typename T> struct G { + T __ptrauth(0,0,1234) test; + // expected-error@-1 2 {{type '__ptrauth(0,0,1234) T' is already __ptrauth-qualified}} +}; + +template <typename T> struct Indirect { + G<T> layers; + // expected-note@-1{{in instantiation of template class 'G<void *__ptrauth(0,0,1235)>' requested here}} + // expected-note@-2{{in instantiation of template class 'G<void *__ptrauth(0,0,1234)>' requested here}} +}; + +void f3() { + Indirect<void* __ptrauth(0,0,1234)> one; + // expected-note@-1{{in instantiation of template class 'Indirect<void *__ptrauth(0,0,1234)>' requested here}} + Indirect<void* __ptrauth(0,0,1235)> two; + // expected-note@-1{{in instantiation of template class 'Indirect<void *__ptrauth(0,0,1235)>' requested here}} + Indirect<void*> three; +} ---------------- AaronBallman wrote:
> @AaronBallman > > __ptrauth qualified pointers can be template parameters, and can be deduced, > however the qualifier itself cannot be dependent, e.g. > > ```c++ > template <class T> struct Foo { > T v; > T *__ptrauth(1,1,1000) ptr; > }; > ``` > > Is valid, and can be instantiated as you would expect with `Foo<int>`, > `Foo<int *>`, or `Foo<int *__ptrauth(1,1,1)>`. With `Foo<int *__ptrauth(1,1,1)>` you would get an error because of the mismatch? > However you can't use template parameters in the qualifier itself, e.g. > > ```c++ > template <unsigned u> struct Foo { > void * __ptrauth(1,1,u) ptr; > } > ``` > > is not valid, but that's just because supporting such has never been high > enough on the priority list. I think it would make sense to support that, but I don't think it's required for the initial implementation. I'd say we should add a test case to show the current behavior and maybe file an issue so we don't forget the improvement. https://github.com/llvm/llvm-project/pull/100830 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits