Debian Codegraph @

gcc/testsuite/g++.dg/ext/is_invocable3.C

raw
1 // { dg-do compile { target c++11 } }
2 // __is_invocable should handle incomplete class correctly.
3
4 #define SA(X) static_assert((X),#X)
5
6 struct Incomplete;
7
8 SA( ! __is_invocable( Incomplete ) ); // { dg-error "incomplete type" }
9 SA( ! __is_invocable( Incomplete, int ) ); // { dg-error "incomplete type" }
10
11 SA( ! __is_invocable( int, Incomplete, int ) ); // { dg-error "incomplete type" }
12 SA( ! __is_invocable( int, Incomplete ) ); // { dg-error "incomplete type" }
13
14 SA( ! __is_invocable( Incomplete, Incomplete() ) ); // { dg-error "incomplete type" }
15 SA( ! __is_invocable( Incomplete, Incomplete(int), int ) ); // { dg-error "incomplete type" }
16 SA( ! __is_invocable( Incomplete, Incomplete(int, int), int, int ) ); // { dg-error "incomplete type" }
17
18 SA( ! __is_invocable( Incomplete, Incomplete(), int, int ) ); // { dg-error "incomplete type" }
19
20 SA( ! __is_invocable( int(Incomplete), Incomplete ) ); // { dg-error "incomplete type" }
21 SA( ! __is_invocable( int(int, Incomplete), int, Incomplete ) ); // { dg-error "incomplete type" }
22 SA( ! __is_invocable( int(int, Incomplete), Incomplete, int ) ); // { dg-error "incomplete type" }
23
24 SA( __is_invocable( int(Incomplete&), Incomplete& ) ); // { dg-bogus "incomplete type" }
25 SA( __is_invocable( int(int, Incomplete&), int, Incomplete& ) ); // { dg-bogus "incomplete type" }
26
27 SA( __is_invocable( int(Incomplete&&), Incomplete&& ) ); // { dg-bogus "incomplete type" }
28 SA( __is_invocable( int(int, Incomplete&&), int, Incomplete&& ) ); // { dg-bogus "incomplete type" }
29
30 SA( __is_invocable( int(const Incomplete&&), const Incomplete&& ) ); // { dg-bogus "incomplete type" }
31 SA( __is_invocable( int(int, const Incomplete&&), int, const Incomplete&& ) ); // { dg-bogus "incomplete type" }
32
33 SA( __is_invocable( int(const Incomplete&), const Incomplete& ) ); // { dg-bogus "incomplete type" }
34 SA( __is_invocable( int(int, const Incomplete&), int, const Incomplete& ) ); // { dg-bogus "incomplete type" }
35
36 SA( __is_invocable( int(const Incomplete&), Incomplete& ) ); // { dg-bogus "incomplete type" }
37 SA( __is_invocable( int(int, const Incomplete&), int, Incomplete& ) ); // { dg-bogus "incomplete type" }
38
39 SA( __is_invocable( int Incomplete::*, const Incomplete& ) ); // { dg-bogus "incomplete type" }
40 SA( ! __is_invocable( void (Incomplete::*)(long&), const Incomplete*, long& ) ); // { dg-bogus "incomplete type" }
41 SA( __is_invocable( void (Incomplete::*)(long&) const, Incomplete*, long& ) ); // { dg-bogus "incomplete type" }
42
43 template <typename T>
44 struct Holder { T t; };
45
46 SA( __is_invocable( int(Holder<Incomplete>&), Holder<Incomplete>& ) ); // { dg-bogus "incomplete type" }
47
48 // Define Incomplete, which is now not incomplete.
49 struct Incomplete { void operator()(); };
50
51 SA( __is_invocable( Incomplete ) ); // { dg-bogus "incomplete type" }