1 // RUN: %clang_cc1 -std=c++1z -verify %s -triple x86_64-unknown-unknown
5 typedef void Nothrow() noexcept
;
14 a
= b
; // expected-error {{incompatible function pointer types assigning to 'Nothrow *' (aka 'void (*)() noexcept') from 'Throw *' (aka 'void (*)()')}}
16 c
= d
; // expected-error {{assigning to 'Nothrow S::*' from incompatible type 'Throw S::*': different exception specifications}}
19 // Function pointer conversions do not combine properly with qualification conversions.
20 // FIXME: This seems like a defect.
21 Nothrow
*const *pa
= b
; // expected-error {{cannot initialize}}
22 Throw
*const *pb
= a
; // expected-error {{cannot initialize}}
23 Nothrow
*const S::*pc
= d
; // expected-error {{cannot initialize}}
24 Throw
*const S::*pd
= c
; // expected-error {{cannot initialize}}
27 // ... The result is a pointer to the function.
29 constexpr void (*p
)() = &f
;
30 static_assert(f
== p
);
32 struct S
{ void f() noexcept
; };
33 constexpr void (S::*q
)() = &S::f
;
34 static_assert(q
== &S::f
);
37 namespace std_example
{
39 void (**pp
)() noexcept
= &p
; // expected-error {{cannot initialize a variable of type 'void (**)() noexcept' with an rvalue of type 'void (**)()'}}
41 struct S
{ typedef void (*p
)(); operator p(); }; // expected-note {{candidate}}
42 void (*q
)() noexcept
= S(); // expected-error {{no viable conversion from 'S' to 'void (*)() noexcept'}}