Debian Codegraph @

gcc/testsuite/g++.dg/concepts/diagnostic17.C

raw
1 // PR c++/98767
2 // { dg-do compile { target c++20 } }
3
4 template <typename Function, typename... Args>
5 concept Callable = requires(Function func, Args... args) { func(args...); };
6
7 static_assert(Callable<int(*)(), bool>); // { dg-error "failed" }
8 // { dg-message {Function = int \(\*\)\(\)} "" { target *-*-* } 5 }
9
10 static_assert(Callable<char(*)(int*), bool>); // { dg-error "failed" }
11 // { dg-message {Function = char \(\*\)\(int\*\)} "" { target *-*-* } 5 }
12
13 static_assert(Callable<short(*)(int*, int), bool>); // { dg-error "failed" }
14 // { dg-message {Function = short int \(\*\)\(int\*, int\)} "" { target *-*-* } 5 }
15
16 static_assert(Callable<long(*)(int*, int, ...), bool>); // { dg-error "failed" }
17 // { dg-message {Function = long int \(\*\)\(int\*, int, \.\.\.\)} "" { target *-*-* } 5 }