1 // RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
3 // Assignment of function pointers.
25 // Some functions to play with below.
32 void s7() throw(int, float);
33 void (*s8())() throw(B1
); // s8 returns a pointer to function with spec
34 void s9(void (*)() throw(B1
)); // s9 takes pointer to function with spec
37 void s11() noexcept(true);
38 void s12() noexcept(false);
42 // Assignment and initialization of function pointers.
43 void (*t1
)() throw() = &s1
; // valid
44 t1
= &s2
; // expected-error {{not superset}}
45 t1
= &s3
; // expected-error {{not superset}}
46 void (&t2
)() throw() = s2
; // expected-error {{not superset}}
47 void (*t3
)() throw(int) = &s2
; // valid
48 void (*t4
)() throw(A
) = &s1
; // valid
51 t4
= &s5
; // expected-error {{not superset}}
52 void (*t5
)() = &s1
; // valid
56 t1
= t3
; // expected-error {{not superset}}
58 void (*t6
)() throw(B1
);
59 t6
= t4
; // expected-error {{not superset}}
62 t1
= t5
; // expected-error {{not superset}}
64 // return types and arguments must match exactly, no inheritance allowed
65 void (*(*t7
)())() throw(B1
) = &s8
; // valid
66 void (*(*t8
)())() throw(A
) = &s8
; // expected-error {{return types differ}}
67 void (*(*t9
)())() throw(D
) = &s8
; // expected-error {{return types differ}}
68 void (*t10
)(void (*)() throw(B1
)) = &s9
; // valid
69 void (*t11
)(void (*)() throw(A
)) = &s9
; // expected-error {{argument types differ}}
70 void (*t12
)(void (*)() throw(D
)) = &s9
; // expected-error {{argument types differ}}
73 // Member function stuff
75 struct Str1
{ void f() throw(int); }; // expected-note {{previous declaration}}
76 void Str1::f() // expected-error {{missing exception specification}}
82 void (Str1::*pfn1
)() throw(int) = &Str1::f
; // valid
83 void (Str1::*pfn2
)() = &Str1::f
; // valid
84 void (Str1::*pfn3
)() throw() = &Str1::f
; // expected-error {{not superset}}