1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++1z %s
5 template<class T
> struct identity
{ typedef T type
; };
7 template<class T
, class C
>
8 void f(T
C::*, typename identity
<T
>::type
*){}
10 struct X
{ void f() {}; };
12 void g() { (f
)(&X::f
, 0); }
16 template<typename S
> void fun(const int* const S::* member
) {}
21 struct B
{ char* x
; };
24 // expected-error@-1 {{no matching function for call to 'fun'}}
25 // expected-note@-9 {{candidate template ignored: could not match 'const int' against 'char'}}
29 #if __cplusplus > 201402L
30 namespace noexcept_conversion
{
31 template<typename R
> void foo(R());
32 template<typename R
> void bar(R()) = delete;
33 template<typename R
> void bar(R() noexcept
) {}
38 // There is no corresponding rule for references.
39 // We consider this to be a defect, and allow deduction to succeed in this
40 // case. FIXME: Check this should be accepted once the DR is resolved.
41 template<typename R
> void baz(R(&)());
46 // But there is one for member pointers.
47 template<typename R
, typename C
, typename
...A
> void quux(R (C::*)(A
...));
48 struct Q
{ void f(int, char) noexcept
{ quux(&Q::f
); } };
52 template <class T
> int h(T
*, T
*); // expected-note {{deduced conflicting types for parameter 'T' ('void () noexcept' vs. 'void ()')}}
53 int x
= h(g1
, g2
); // expected-error {{no matching function}}
55 // We consider it a defect that deduction does not support the following.
56 // FIXME: Check that the defect is resolved as we expect.
57 template<bool B
> int i(void () noexcept(B
));