Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / SemaTemplate / ctad.cpp
blob1bf605f823bbe3f78a6e1585776d89107404f9b4
1 // RUN: %clang_cc1 -std=c++17 -verify %s
3 namespace pr41427 {
4 template <typename T> class A {
5 public:
6 A(void (*)(T)) {}
7 };
9 void D(int) {}
11 void f() {
12 A a(&D);
13 using T = decltype(a);
14 using T = A<int>;
18 namespace Access {
19 struct B {
20 protected:
21 struct type {};
23 template<typename T> struct D : B { // expected-note {{not viable}} \
24 expected-note {{implicit deduction guide declared as 'template <typename T> D(D<T>) -> D<T>'}}
25 D(T, typename T::type); // expected-note {{private member}} \
26 // expected-note {{implicit deduction guide declared as 'template <typename T> D(T, typename T::type) -> D<T>'}}
28 D b = {B(), {}};
30 class X {
31 using type = int;
33 D x = {X(), {}}; // expected-error {{no viable constructor or deduction guide}}
35 // Once we implement proper support for dependent nested name specifiers in
36 // friends, this should still work.
37 class Y {
38 template <typename T> friend D<T>::D(T, typename T::type); // expected-warning {{dependent nested name specifier}}
39 struct type {};
41 D y = {Y(), {}};
43 class Z {
44 template <typename T> friend class D;
45 struct type {};
47 D z = {Z(), {}};
50 namespace GH69987 {
51 template<class> struct X {};
52 template<class = void> struct X;
53 X x;
55 template<class T, class B> struct Y { Y(T); };
56 template<class T, class B=void> struct Y ;
57 Y y(1);
60 namespace NoCrashOnGettingDefaultArgLoc {
61 template <typename>
62 class A {
63 A(int = 1); // expected-note {{candidate template ignored: couldn't infer template argumen}} \
64 // expected-note {{implicit deduction guide declared as 'template <typename> D(int = <null expr>) -> D<type-parameter-0-0>'}}
66 class C : A<int> {
67 using A::A;
69 template <typename>
70 class D : C { // expected-note {{candidate function template not viable: requires 1 argument}} \
71 expected-note {{implicit deduction guide declared as 'template <typename> D(D<type-parameter-0-0>) -> D<type-parameter-0-0>'}}
72 using C::C;
74 D abc; // expected-error {{no viable constructor or deduction guide}}