Skip to content

Commit 9cbf8b0

Browse files
committed
Add more tests for concept
1 parent 24f33cd commit 9cbf8b0

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

clang/test/SemaCXX/ptrauth-qualifier.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ namespace test_concept {
179179

180180
template <typename T>
181181
concept Ptrauthable = is_qualified<T>::value;
182-
// expected-note@-1 {{because 'is_qualified<int *>::value' evaluated to false}}
183-
// expected-note@-2 {{because 'is_qualified<int *__ptrauth(1,1,51)>::value' evaluated to false}}
182+
// expected-note@-1 2 {{because 'is_qualified<int *>::value' evaluated to false}}
183+
// expected-note@-2 2 {{because 'is_qualified<int *__ptrauth(1,1,51)>::value' evaluated to false}}
184184

185185
template <typename T>
186186
requires(Ptrauthable<T>)
@@ -193,4 +193,21 @@ namespace test_concept {
193193
// expected-error@-1 {{constraints not satisfied for class template 'S' [with T = int *]}}
194194
S<int * AQ2> s1;
195195
// expected-error@-1 {{constraints not satisfied for class template 'S' [with T = int *__ptrauth(1,1,51)]}}
196+
197+
template <typename T>
198+
requires(Ptrauthable<T>)
199+
void func(T *);
200+
// expected-note@-1 {{candidate template ignored: constraints not satisfied [with T = int *]}}
201+
// expected-note@-3 {{because 'int *' does not satisfy 'Ptrauthable'}}
202+
// expected-note@-3 {{candidate template ignored: constraints not satisfied [with T = int *__ptrauth(1,1,51)]}}
203+
// expected-note@-5 {{because 'int *__ptrauth(1,1,51)' does not satisfy 'Ptrauthable'}}
204+
205+
void test() {
206+
int * AQ p0;
207+
int *p1;
208+
int * AQ2 p2;
209+
func(&p0);
210+
func(&p1); // expected-error {{no matching function for call to 'func'}}
211+
func(&p2); // expected-error {{no matching function for call to 'func'}}
212+
}
196213
}

0 commit comments

Comments
 (0)