blob: cfd55eed81d59ad6f6d74637f4f3cae223b4a813 [file] [log] [blame]
Douglas Gregor717a2bf2010-11-08 03:58:01 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2void g();
3
4void f(); // expected-note 9{{candidate function}}
5void f(int); // expected-note 9{{candidate function}}
6
Douglas Gregor1be8eec2011-02-19 21:32:49 +00007template<class T> void t(T); // expected-note 6{{candidate function}}
8template<class T> void t(T*); // expected-note 6{{candidate function}}
Douglas Gregor717a2bf2010-11-08 03:58:01 +00009
10template<class T> void u(T);
11
12int main()
13{
14 { bool b = (void (&)(char))f; } // expected-error{{does not match required type}}
15 { bool b = (void (*)(char))f; } // expected-error{{does not match required type}}
16
17 { bool b = (void (&)(int))f; } //ok
18 { bool b = (void (*)(int))f; } //ok
19
20 { bool b = static_cast<void (&)(char)>(f); } // expected-error{{does not match}}
21 { bool b = static_cast<void (*)(char)>(f); } // expected-error{{address of overloaded function}}
22
23 { bool b = static_cast<void (&)(int)>(f); } //ok
24 { bool b = static_cast<void (*)(int)>(f); } //ok
25
26
27 { bool b = reinterpret_cast<void (&)(char)>(f); } // expected-error{{cannot resolve}}
28 { bool b = reinterpret_cast<void (*)(char)>(f); } // expected-error{{cannot resolve}}
29
30 { bool b = reinterpret_cast<void (*)(char)>(g); } //ok
31 { bool b = static_cast<void (*)(char)>(g); } // expected-error{{not allowed}}
32
33 { bool b = reinterpret_cast<void (&)(int)>(f); } // expected-error{{cannot resolve}}
34 { bool b = reinterpret_cast<void (*)(int)>(f); } // expected-error{{cannot resolve}}
35
36 { bool b = (int (&)(char))t; } // expected-error{{does not match}}
37 { bool b = (int (*)(char))t; } // expected-error{{does not match}}
38
39 { bool b = (void (&)(int))t; } //ok
40 { bool b = (void (*)(int))t; } //ok
41
42 { bool b = static_cast<void (&)(char)>(t); } //ok
43 { bool b = static_cast<void (*)(char)>(t); } //ok
44
45 { bool b = static_cast<void (&)(int)>(t); } //ok
46 { bool b = static_cast<void (*)(int)>(t); } //ok
47
48
49 { bool b = reinterpret_cast<void (&)(char)>(t); } // expected-error{{cannot resolve}}
50 { bool b = reinterpret_cast<void (*)(char)>(t); } // expected-error{{cannot resolve}}
51
52 { bool b = reinterpret_cast<int (*)(char)>(g); } //ok
53 { bool b = static_cast<int (*)(char)>(t); } // expected-error{{cannot be static_cast}}
54 { bool b = static_cast<int (&)(char)>(t); } // expected-error{{does not match required}}
55
56 { bool b = static_cast<void (&)(char)>(f); } // expected-error{{does not match}}
57}