Debian Codegraph @

clang/test/SemaCXX/ptrauth-template-parameters.cpp

raw
1 // RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -verify -fptrauth-intrinsics -std=c++11 %s
2 // RUN: %clang_cc1 -triple aarch64-linux-gnu -fsyntax-only -verify -fptrauth-intrinsics -std=c++11 %s
3
4 template <typename T> struct G {
5 T __ptrauth(0,0,1234) test;
6 // expected-error@-1 2 {{type '__ptrauth(0,0,1234) T' is already '__ptrauth'-qualified}}
7 };
8
9 template <typename T> struct Indirect {
10 G<T> layers;
11 // expected-note@-1{{in instantiation of template class 'G<void *__ptrauth(0,0,1235)>' requested here}}
12 // expected-note@-2{{in instantiation of template class 'G<void *__ptrauth(0,0,1234)>' requested here}}
13 };
14
15 template <int K, int A, int D>
16 struct TemplateParameters {
17 void * __ptrauth(K, 0, 100) m1; // expected-error {{expression is not an integer constant expression}}
18 void * __ptrauth(0, A, 100) m2; // expected-error {{argument to '__ptrauth' must be an integer constant expression}}
19 void * __ptrauth(0, 0, D) m3; // expected-error {{argument to '__ptrauth' must be an integer constant expression}}
20 };
21
22 void f3() {
23 // FIXME: consider loosening the restrictions so that the first two cases are accepted.
24 Indirect<void* __ptrauth(0,0,1234)> one;
25 // expected-note@-1{{in instantiation of template class 'Indirect<void *__ptrauth(0,0,1234)>' requested here}}
26 Indirect<void* __ptrauth(0,0,1235)> two;
27 // expected-note@-1{{in instantiation of template class 'Indirect<void *__ptrauth(0,0,1235)>' requested here}}
28 Indirect<void*> three;
29 }