================
@@ -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:

> > > and __ptrauth can't be used on function parameters.
> > 
> > 
> > See comments elsewhere, we either have a bug or a misunderstanding.
> 
> Sorry, I meant the `__ptrauth` qualifiers currently cannot be used as a 
> top-level qualifier of function parameters.
> 
> ```
> int func1(void * __ptrauth(1, 0, 100) ptr); // error: parameter types may not 
> be qualified with __ptrauth; type is 'void *__ptrauth(1,0,100)'
> int func2(void * __ptrauth(1, 0, 100) * ptr); // OK
> ```

Ah, thanks! Then we can test the behavior of overloading.

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

Reply via email to