Revert "Reland '[flang] Allow to pass an async id to allocate the descriptor (#118713...
[llvm-project.git] / clang / test / CXX / temp / temp.fct.spec / temp.deduct / temp.deduct.call / p4.cpp
blobfe0af399f7b9c6f6b78fdd3d61a7f71607093e67
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++1z %s
4 namespace PR8598 {
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); }
15 namespace PR12132 {
16 template<typename S> void fun(const int* const S::* member) {}
17 struct A { int* x; };
18 void foo() {
19 fun(&A::x);
21 struct B { char* x; };
22 void bar() {
23 fun(&B::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) {}
34 void f() throw() {
35 foo(&f);
36 bar(&f);
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(&)());
42 void g() {
43 baz(f);
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); } };
50 void g1() noexcept;
51 void g2();
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));
58 int i1 = i(g1);
59 int i2 = i(g2);
61 #endif