Skip to content

Commit 636e815

Browse files
committed
Add tests for rejecting template parameters being passed to __ptrauth
1 parent c95c9dd commit 636e815

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ template <typename T> struct Indirect {
1212
// expected-note@-2{{in instantiation of template class 'G<void *__ptrauth(0,0,1234)>' requested here}}
1313
};
1414

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+
1522
void f3() {
1623
// FIXME: consider loosening the restrictions so that the first two cases are accepted.
1724
Indirect<void* __ptrauth(0,0,1234)> one;

0 commit comments

Comments
 (0)