• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 void g();
3 
4 void f(); // expected-note 9{{candidate function}}
5 void f(int); // expected-note 9{{candidate function}}
6 
7 template<class T> void t(T); // expected-note 6{{candidate function}}
8 template<class T> void t(T*); // expected-note 6{{candidate function}}
9 
10 template<class T> void u(T);
11 
main()12 int 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 }
58